Q)____________ members of base class are inaccessible to derived class
- Private
- Protected
- Public
- None
Answer: 1
Q) Accessing functions from multiple classes to a derived class is known as
- multiple inheritance
- single inheritance
- Hybrid inheritance
- multilevel inheritance
Answer: 1
Q) In inheritance, order of execution of base class and derived class destructors are
- Base to derived
- Derived to base
- Random order
- none
Answer: 2
In inheritance, execution order of constructors are always from base to derived and destructors call order is in reverse i.e. from derived to base. In polymorphic classes, means the class that contain virtual functions, we need to make destructor virtual in base class. Other wise the derived class destructor will not be called. Read detail about C++ virtual destructor with example.
Pages: 1 2