Introducing Classes

In C++ we define our own data structure by defining a class. The class mechanism is one of the most important features in C++. In fact, a primary focus of the design of C++ is to make it possible to define class types that behave as naturally as the built-in types themselves. The library types that we’ve seen already, such as istream and ostream, are all defined as classesthat is, they are not strictly speaking part of the language.
Complete understanding of the class mechanism requires mastering a lot of information. Fortunately, it is possible to use a class that someone else has written without knowing how to define a class ourselves.
To use a class we need to know three things:

  1. What is its name?
  2. Where is it defined?
  3. What operations does it support?

You may also like...