(i)Which type of inheritance is demonstrated above ? |
father class is protected inheritance
mother class is private inheritance
(ii)Name the base class and the derived class. |
base class - parent
derived class - father and mother
(iii)Name the data members that can be accessed from the object of class –
(a)Mother |
all, except the private members
all, except the private members
(iv)Name the members that can be accessed from the member functions of the class Mother. |
all members of mother and parent except the name which is private.
(v)What all constructors will be invoked and in what sequence if we create an object of the class Mother. |
i am not sure, but as far as i remember.
if you create an object of derived class, the constructor of base class will be called first and then the constructor of derived class, if the object of derived class is destroyed or go out of scope the derived class's destructor will be called first and then the base class's.
EDIT:
so in other words, base on the code, the default constructor of the parent class will be called first and then the default constructor of mother class
(vi)How many bytes will be allocated to an object of class Mother |
i think 18 or so?