Access specifiers in C++ are keywords used to define the accessibility of the class members (attributes, methods) from outside the class. They help in implementing the core principle of encapsulation, which is essential in object-oriented programming. There are three types of access specifiers:
public
: Members declared as public can be accessed from anywhere the class object is visible.protected
: Members declared as protected can be accessed within the class itself, by classes derived from it (child/subclasses), but not by other parts of the program.private
: Members declared as private can only be accessed within the class itself and are not accessible by derived classes or other parts of the program.
In the exercise, the specifier used is
public
, which means that the derived class will inherit the public and protected members of the base class, and they will have the same access in the derived class as they did in the base class.