Can't continue book until I get answer for this

This is a discussion on Can't continue book until I get answer for this within the C++ Programming forums, part of the General Programming Boards category; could you explain this for me? ostream& operator<< (ostream, Array <T>&); Like what's an ostream object and so on....

  1. #1
    left crog... back when? incognito's Avatar
    Join Date
    Oct 2001
    Posts
    1,427

    Can't continue book until I get answer for this

    could you explain this for me?

    ostream& operator<< (ostream, Array <T>&);

    Like what's an ostream object and so on.
    There are some real morons in this world please do not become one of them, do not become a victim of moronitis. PROGRAMMING IS THE FUTURE...THE FUTURE IS NOW!!!!!!!!!

    "...The only real game I thank in the world is baseball..." --Babe Ruth

    "Life is beautiful"-Don Corleone right before he died.

    "The expert on anything was once a beginner" -Baseball poster I own.


    Left cprog on 1-3-2005. Don't know when I am coming back. Thanks to those who helped me over the years.

  2. #2
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,796
    >ostream& operator<< (ostream, Array <T>&);
    This is the overloaded operator method for output streams. You can could define output for your class with it:
    yourclass<<stuff;

    will perform output depending on how you define the << operator.

    -Prelude
    My best code is written with the delete key.

  3. #3
    left crog... back when? incognito's Avatar
    Join Date
    Oct 2001
    Posts
    1,427
    What would be an ostream object. I understand this function takes an ostream object, but I don't know what an ostream object is. Could you give me an example.
    There are some real morons in this world please do not become one of them, do not become a victim of moronitis. PROGRAMMING IS THE FUTURE...THE FUTURE IS NOW!!!!!!!!!

    "...The only real game I thank in the world is baseball..." --Babe Ruth

    "Life is beautiful"-Don Corleone right before he died.

    "The expert on anything was once a beginner" -Baseball poster I own.


    Left cprog on 1-3-2005. Don't know when I am coming back. Thanks to those who helped me over the years.

  4. #4
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,796
    >but I don't know what an ostream object is.
    cout is an ostream, if you define an fout then that is an ostream as well.

    -Prelude
    My best code is written with the delete key.

  5. #5
    Unregistered
    Guest
    And lo, before the programmer writ his program, the compiler writer begat predefined classes. And s/he called them likes ios and iostream and fstream and math and so on. And s/he saw that they were good and loaded with plenty o methods and operators. For it is known that the compiler writer wanted programmers to use objects derived from these classes to write new and wonderful, if sometimes weird, pieces of software. Indeed, to make the programmers live easier, the compiler writers even declared (at least) two predefined ojects for the programmer to use. These s/he called cin, which was begat of iostream, and was to be used to allow the programmer to allow the lowly user to interact with all that was writ by the programmer by use of the keyboard. And the other was cout, begat of ofstream class, which allowed the programmer to amaze the user by showing output of the program on the screen. In addition the compiler writer allows the programmer to have some say in how to use cin and cout through the methods provided. Indeed, the compiler writer even allows the user to create their own, not predefined, instances of stream objects possessed of all the attributes of cin and cout but tailored to their needs. However despite their greater knowledge the compiler writers could not forsee all the possible things that would need to interact with their classes, so they imbued the power of overloading to the programmer so they can get things to work the way they want (after much consternation usually). After all, the hardware that actually does things must be told how to do everything, like how to place the information in a object to the screen, whether the compiler writer tells it in a prefined class or the programmer tells it in a user defined class. And in the end programs are developed and everyone is happy.

  6. #6
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,796
    >And in the end programs are developed and everyone is happy.
    Nay, the compiler writers from on high knew of the lowly beings who would make use of their creations and the mistakes they would make. Thus the great compiler writers implemented an operation they deemed "syntactic and semantic checking" to punish those who strayed from the path of the great standard. Those poor souls who walked in the darkness would be struck down with the great wrath of error messages and compiler warnings.

    Yet despite the glory of the compiler writers, there was a greater power known only as OS coders. As the OS coders gazed upon the compiler writers, they too chose to add a feature for which to smite sinners and proceeded to implement error messages of their own. These great messages were given the power of the run-time crash and blue screen of death, two mighty weapons with which the OS coders would cleanse the world of sin.

    And since, terror and fear abounded as all but a few chosen strayed from the path of the standard only to be drowned in their indulgence of sin. And those few who remained loyal were thus rewarded with happiness and bliss, never to be dogged by bugs.

    -Prelude
    My best code is written with the delete key.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. JavaScript book recommendations
    By neandrake in forum Tech Board
    Replies: 2
    Last Post: 04-05-2009, 12:27 PM
  2. Looking for a c++ book, didn't were to post this...
    By Rune Hunter in forum C++ Programming
    Replies: 6
    Last Post: 09-24-2004, 06:32 PM
  3. Must read book!
    By RealityFusion in forum A Brief History of Cprogramming.com
    Replies: 7
    Last Post: 07-15-2004, 09:05 PM
  4. Newbie - MFC code from a book in VC++.Net
    By Guardian in forum Windows Programming
    Replies: 2
    Last Post: 04-27-2002, 07:17 PM
  5. code help :)
    By Unregistered in forum C Programming
    Replies: 4
    Last Post: 02-28-2002, 12:12 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21