A derived class name is separated from its access specifier with a colon. For example, the following code defines a derived class named Derived from the base class Base:
the name of the derived class. The access specifier for the derived class is then specified, followed by the body of the derived class.
In the above example, the derived class Derived is defined to have public access. This means that the members of the derived class can be accessed from any other class in the program.
The access specifier for a derived class can be any of the following:
public: The members of the derived class can be accessed from any other class in the program.
protected: The members of the derived class can be accessed from any class in the same derived class hierarchy.
private: The members of the derived class can only be accessed from the derived class itself.