In C++, the class forms the basis for Object oriented programming. The class is used to define the nature of an object.
Classes are created using the keyword class. A class declaration defines new type that links data and code.This new type is then used to create objects of that particular class.
Thus class is a logical abstraction, but an object has physical existence.
A class declaration is similar to a structure declaration syntactically.
Syntax of class
access specifier:data members and member functions;
access specifier:data members and member functions; }Object-list;
The object list is optional. If present, that would be declared as object of that class.
Access specifiers can be:
By default, the access specifier is set to private. So if no access specifier is declared it would automatically assign private to it.