CS Electrical And Electronics
@cselectricalandelectronics

What happens when base class is privately inherited by a derived class?

All QuestionsCategory: Cpp LanguageWhat happens when base class is privately inherited by a derived class?
CS Electrical And Electronics Staff asked 4 years ago

I need short information.

1 Answers
CS Electrical And Electronics Staff answered 4 years ago

The following things happens when the base class is privately inherited by a derived class:

  1. Public members of base class become ‘private members’ of the derived class.
  2. Public members of the base class can only be accessed by the member functions of the derived class.
  3. They are inaccessible to the objects of the derived class.

Ex: class marks  : private student