iostream class

I just came to know that all the files i.e

iostream , fstream are basically classes .

Then how do we directly use the functions defined in them ,

Why dont we first create an object then do
object.cout << "hello world";

I would really appreciate an answer
Last edited on
cout is an object of type ostream. Same for cin. You do need to declare files yourself though.
thanks hamsterman ,

Now i understand , cout , cin are objects and not functions .

College teachers dont teach c++ so well , they told cout and others were functions
defined in these files.

You do need to declare files yourself though.


But i couldn't understand what you mean by declaring files.
Do you mean including them using the #include ?

Thanks again , for clearing my doubts .
I meant fstream objects. Sorry about confusion caused.
Remember too that iostream is not a class, but rather a name of a header file. istream and ostream are the actual classes defined in that header file.
@Maese, while you do make a good point, about header names being different from classes in them, note that there actually is an iostream class.
Now i am confused ,

Is iostream ,
a class
or a header file
or is it a class defined in a header file .
The header named iostream contains several classes and object declarations. Among those classes, there is one coincidentally named iostream. Better?
thanks webJose , you cleared all my doubts ,

thanks a lot everyone
Topic archived. No new replies allowed.