Classes
Within C++ language, the class forms the basis of object-oriented programming. Specially, it is the class which is used to describe the nature of an object. Actually, the class is C++'s basic unit of encapsulation. In this chapter, classes and objects are examined in detail.
Classes are created by using the keyword class. A class declaration defines a new type in which links code and data. That new type is then used to declare objects of that class. Therefore, a class is a logical abstraction, but an object has physical existence. Instead, an object is an instance of a class.
A class declaration is same syntactically to a structure. Here, is the whole general form of a class declaration which does not inherit any other class.
Class class-name
{
private data and functions access-specifier:
data and functions access-specifier:
data and functions
.
.
.
access-specifier:
data and functions
}object-list;
The object-list is optional. It declares objects of the class If present.