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.
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