Jul 22, 2011 at 5:41am
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 Jul 22, 2011 at 5:46am
Jul 22, 2011 at 6:20am
cout is an object of type ostream. Same for cin. You do need to declare files yourself though.
Jul 22, 2011 at 1:30pm
I meant fstream objects. Sorry about confusion caused.
Jul 22, 2011 at 2:45pm
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.
Jul 22, 2011 at 5:42pm
@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.
Jul 23, 2011 at 4:21am
Now i am confused ,
Is iostream ,
a class
or a header file
or is it a class defined in a header file .
Jul 23, 2011 at 4:30am
The header named iostream contains several classes and object declarations. Among those classes, there is one coincidentally named iostream. Better?
Jul 23, 2011 at 4:39am
thanks webJose , you cleared all my doubts ,
thanks a lot everyone