< previous page page_849 next page >

Page 849
(The actual declarations are slightly different from these, but the differences are not important to this discussion.)
The istream class has many member functions, two of whichthe get function and the ignore functionyou have already seen in statements like these:
cin.get(someChar);
cin.ignore(200, \n);
As with any C++ class object, we use dot notation to select a particular member function to invoke.
You also have used C++ classes when performing file I/O. The header file fstream.h contains declarations for the ifstream and ofstream classes. The client code
ifstream dataFile;

dataFile.open(input.dat);
declares an ifstream class object named dataFile, then invokes the class member function open to try to open a file input.dat for input.
We do not examine in detail the istream, ostream, ifstream, and ofstream classes and all of their member functions. To study these would be beyond the goals of this book. What is important to recognize is that classes and objects are fundamental to all I/O activity in a C++ program.
Class Scope
As with members of a struct, the name of a class member has class scope that is, the name is local to the class. If the same identifier happens to be declared outside the class, the two identifiers are unrelated.
The TimeType class has a member function named Write. In the same program, another class (say, SomeClass) could also have a member function named Write. Furthermore, the program might have a global Write function that is completely unrelated to any classes. If the program has statements like
TimeType  checkInTime;
SomeClass someObject;
int       n;
  .
  .
  .

 
< previous page page_849 next page >