Hey there Sign in to join this conversationNew here? Join for free

C++ questions

Announcements Posted on
TSR Movie Madness. Vote and debate in all of the group finals from now to Saturday evening! 15-07-2014
    • 1 follower
    Offline

    ReputationRep:
    (Original post by INTit)
    It's a class with a templated, overloaded '<' operator which allows access to the output stream. Ok maybe there's a good reason tutorials don't go into too much detail explaining cout lol.
    The way objects are usually called is with the objects name and then call a function from the class.

    Putting the cout object as a template stops you from having to put the object name and then calling the function to make this work, allowing you to just use the word cout and not having to call it from a object reference if that makes any sense? As far as I understand this of course.
    • 13 followers
    Offline

    ReputationRep:
    (Original post by j.smith1981)
    The way objects are usually called is with the objects name and then call a function from the class.

    Putting the cout object as a template stops you from having to put the object name and then calling the function to make this work, allowing you to just use the word cout and not having to call it from a object reference if that makes any sense? As far as I understand this of course.
    cout is actually an object itself

    http://www.cplusplus.com/reference/iostream/cout/

    It's an object of type "ostream". In the ostream class the "<<" operator is defined which is basically equivalent to a function but with different syntax. There are different versions (overloads) of this operator for different data types.

    The implementation of the ostream class may use templates, I'm not sure. But if you're just using it you probably don't need to worry about how cout is implemented.

Reply

Submit reply

Register

Thanks for posting! You just need to create an account in order to submit the post
  1. this can't be left blank
    that username has been taken, please choose another Forgotten your password?

    this is what you'll be called on TSR

  2. this can't be left blank
    this email is already registered. Forgotten your password?

    never shared and never spammed

  3. this can't be left blank

    6 characters or longer with both numbers and letters is safer

  4. this can't be left empty
    your full birthday is required
  1. By joining you agree to our Ts and Cs, privacy policy and site rules

  2. Slide the button to the right to create your account

    Slide to join now Processing…

Updated: March 19, 2012
New on TSR

What are your A-level predictions?

Join our AS and A2 results day chat thread

Article updates
Useful resources
Reputation gems:
You get these gems as you gain rep from other members for making good contributions and giving helpful advice.