Classes - What do they buy you?


A class is the language construct that allows you to build objects. They are an important part of what makes C++ object-oriented.
Because a class is a generalised data type, the compiler can check the legality of operations on objects of that class.
The class provides a mechanism for effective code sharing through inheritance. A class may be derived from a parent class. The derived class inherits data and functions of the parent. The derived class may define additional data and functions or replace them.
Classes can be used to support abstraction by specifying an interface without providing an implementation.
Template classes permit the "compiler" to automatically generate related classes based on type information.