1

i read in Turbo c++ in help tab that iostream is a class but till I knw my lecturer taught us that it is an header file so which one is true iostream is an header file or a class??

keerthi
  • 77
  • 1
  • 1
  • 4
  • 6
    I suggest you [pick up a good book](http://stackoverflow.com/questions/388242/the-definitive-c-book-guide-and-list). –  Jun 07 '12 at 03:06

2 Answers2

2

... Or both. You can include the header <iostream> and there is a type std::iostream

David Rodríguez - dribeas
  • 204,818
  • 23
  • 294
  • 489
1

iostream is indeed a class in C++. You obtain access to this class by including the file named iostream in your code:

// SomeFile.cpp
#include <iostream>

// Some code that makes use of the class iostream...

This also holds for other stream classes within C++ such as istream, ostream, fstream, and so forth. Dig around in the include directory of your C++ installation to get a look at these classes if you wish.

This is of course a very common situation in C++ since one often encounters classes whose actual definitions are stored in files with the same name as the class but with .hpp or .cpp extensions.

pmcs
  • 1,123
  • 10
  • 16
  • 1
    so...iostream is a file/header file...in which iostream class exists and which we use in our programs??right?? – keerthi Jun 07 '12 at 02:44