Itself defined the base classs constructor is called

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: ned The base class's constructor is called to initialize the The base data members inherited from the base class data The derived class's constructor is then called to initialize The derived the data members added in the derived class the The derived-class object is then usable The derived-class When the object is destroyed (goes out of scope or is When deleted) the derived class's destructor is called on the derived object first object Then the base class's destructor is called on the object Then base Finally the allocated space for the full object is reclaimed Finally allocated Advantages of inheritance Advantages When a class inherits from another class, When there are three benefits: there (1) You can reuse the methods and data (1) reuse of the existing class of (2) You can extend the existing class by (2) extend adding new data and new methods adding (3) You can modify the existing class by (3) modify overloading its methods with your own implementat...
View Full Document

Ask a homework question - tutors are online