When a base class is inherited as public by the derived class? What happens to its public members? What happens to its private members? If the base has inherited as private by the derived class. What happens to it public and private member?

Subject Object Oriented Programming
NU Year Set: 4.(d) Marks: 5 Year: 2009

Derived Classes
• It is sometimes the case that we have a class
is nearly what we need.
• Derived classes acquire the properties of an
existing class.
• The original class is called the base class.

Implementation of public inheritance
class CommissionWorker : public
Employee {
...
};
– Class CommissionWorker inherits from
class Employee
– friend functions not inherited
– private members of base class not accessible
from derived clas

Login to post your comment.