+ 10
Why is cout called an operator
17 ответов
+ 9
std::cout is a global object, not an operator. << is an operator.
+ 8
Because it concentrates on output.
+ 5
Chidi Anioke, concentrate on how to *use* it, how to bring output to the screen.
How it works internally, together with all the terminology, is something you can gradually pick up as you go.
+ 4
~ swim ~ please can u explain further. Your terminologies (overloads ostream extraction operation) is not clear.
I am new hear, u know
Thanks a million.
+ 4
Woooow!! Okey, thanks.
+ 4
U are a good friend HonFu
+ 4
Thank you so much @Sonic
Is there a global Class to which the global object is a part of.
+ 3
Chidi Anioke
yes the std::cout belongs to global std::ostream class which is defined in std namespace and its declaration resides in <iostream>.
+ 2
Thank you GHOST.scared("yes");
Just for clarification:
Std means standard, right?
Please in a more generic terms can u kindly explain what you mean by
1. std::ostream class being defined in std namespace.
2. And it's declaration resides in <iostream>
Thank you.
+ 2
Since it writes to the output stream 😉
+ 1
Because its a keyword and we used to print a message on the console
+ 1
Chidi Anioke
Sorry friend for being late....
1st.
For std, you are definitely right it stands for standard.
2nd.
For std::ostream I assume u have learned classes.
std::ostream is a stand alone class which stands for output stream.
It outputs stream of bytes to the console.
This class is declared in <iostream> header which means that its signature, and its functions declaration lies within this iostream header.
And std::cout is one of these functions, for which exertion operator has been overloaded.
Remember: cout is a function and << is the operator.
ostream class is defined in namespace std.
Which means that its implementation is present in std namespace.
Its internal mechanism like how should we for example, output int, float and other data types to terminal or console.
I hope this helps u...
Happy Coding
+ 1
Chidi Anioke
Friend i checked ur profile.
I think you have jumped in to Cpp recently so i suggest you to not go into deeper concepts but spend this time in getting ur basics extremely right.
Afterthen ofcourse you can crack C++ to its knees.
Take your time
+ 1
Cout is a term for console output
+ 1
It's not a operator. Cout means console output which you give output in c++