Solved Problem Solved Problem#CPP#5953
Problem Statement - 02D-2015
Answer the questions (i) to (iv) based on the following:
class Interior { int OrderId; char Address[20]; protected: float Advance; public: Interior(); void Book(); void View(); }; class Painting:public Interior { int WallArea,ColorCode; protected: char Type; public: Painting(); void PBook(); void PView(); }; class Billing:public Painting { float Charges; void Calculate(); public: Billing(); void Bill(); void BillPrint(); };
(i) Which type of Inheritance out of the following is illustrated in the above example?
– Single Level Inheritance
– Multi Level Inheritance
– Multiple Inheritance
(ii) Write the names of all the data members, which are directly accessible from the member functions of class Painting.
(iii) Write the names of all the member functions, which are directly accessible from an object of class Billing.
(iv) What will be the order of execution of the constructors, when an object of class Billing is declared?
Solution
(i) Multi Level Inheritance
(ii) WallArea, ColorCode,Type, Advance
(iii) Bill(), BillPrint(), PBook(), PView(), Book(), View()
(iv) Interior, Painting, Billing;