PROGRAMMING IN C++
4. Multiple 5. Hybrid
Defining Derived Classes
}
colon indicates that the derived-class name is derived
from the base class
visibility-mode
is optional, by default it is private
if present, may be public or protected or private
Example:
(in this XYZ is the base class and ABC is the derived class)
class A
{
private:
. // optional
. // visible to member functions within its class
protected:
..
... //visible to member functions of its own and derived class
public:
.
. // visible to all functions in the program
};
When a protected member is inherited in
public mode, it becomes protected in the
derived class too and therefore is accessible
by the member functions of the derived class.