f78
Input and output together: class iostream
If you need to use the same stream for input and output, you can use an object of the class iostream, which is derived from both istream and ostream.
The constructors for iostream behave just like the constructors for istream.
iostream::iostream () Constructor
When used without arguments, iostream constructs the ios object, and initializes the input counter (the value reported by istream::gcount) to 0.
iostream::iostream (streambuf* sb [,ostream*tie]) Constructor
You can also call a constructor with one or two arguments. The first argument, sb, is a streambuf*; if you supply this pointer, the constructor uses that streambuf for input and output. You can use the optional second argument, tie (an ostream*), to specify a related output stream as the initial value for ios::tie.
As for ostream and istream, iostream simply uses the ios destructor. However, an iostream is not deleted by its destructor.
You can use all the istream, ostream, and ios methods with an iostream object.