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
class class-name{
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:
- Private
- Public
- Protected
By default, the access specifier is set to private. So if no access specifier is declared it would automatically assign private to it.
Administrador de ENGGDRCAOS. Canal dedicado especialmente a la formación del estudiante que aspira a ser ingeniero. Todos los videos son Ingles. Apasionado del universo Apple, estudiante de Ingeniería y Gamer por vocación.