I/O streams & std namespace

Hi, I am trying to learn about the IO streams and have a question regarding that and std namespace. From this page It appears that all the streams inherit from ios_base, eg iostream, fstream etc. So I am wondering about the functions in these stream classes, for instance cout, (not sure if classified as a function) is it declared in the stream class or in std namespace, since i need to include iostream to use cout and include std namespace.

cout, cin, cerr, clog are global variables that are defined in the std namespace.
Ok so is it like, ostream is a class defined somewhere, and then in namespace std cout is declared as a global of type ostream?

And now that I think about it again, I know that cout if not a function because it is just the output stream.
Ok so is it like, ostream is a class defined somewhere, and then in namespace std cout is declared as a global of type ostream?

You are right.
If you want some more information:
https://stackoverflow.com/questions/33110526/how-does-stdcout-declaration-work
Thank you for the help, I will look into the link.
Topic archived. No new replies allowed.