The istream class provides the basic capability for sequential and random-access input. An istream object has a streambuf-derived object attached, and the two classes work together; the istream class does the formatting, and the streambuf class does the low-level buffered input.
You can use istream objects for sequential disk input if you first construct an appropriate filebuf object. More often, you will use the predefined stream object cin (which is actually an object of class istream_withassign), or you will use objects of classes ifstream (disk file streams) and istrstream (string streams).
It is not always necessary to derive from istream in order to add functionality to a stream; consider deriving from streambuf instead, as illustrated in Chapter 19 of the Class Libraries User's Guide. The ifstream and istrstream classes are examples of istream-derived classes that construct member objects of predetermined derived streambuf classes.
You can add manipulators without deriving a new class.
If you add new extraction operators for a derived istream class, then the rules of C++ dictate that you must reimplement all the base class extraction operators. See the “Derivation” section of class ostream for an efficient reimplementation technique.
#include <iostream.h>
streambuf, ifstream, istrstream, istream_withassign