-->

Constructor And Destructor

Question
CBSEENCO12011669

Answer the questions (i) to (iv) based on the following:

class Exterior
{
	int OrderId;
	char Address[20];
protected:
	float Advance;
public:
	Exterior();
	void Book(); 
	void View();
};
class Paint:public Exterior
{
	int WallArea,ColorCode;
protected:
	char Type;
public:
	Paint();
	void PBook();
	void PView();
};
class Bill : public Paint
{
	float Charges;
	void Calculate();
	public :
	Bill();
	void Billing();
	void Print();
};

(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 Paint.

(iii) Write the names of all the member functions, which are directly accessible from an object of class Bill.

(iv) What will be the order of execution of the constructors, when an object of class Bill is declared?

Solution

(i) Multi-Level Inheritance is illustrated in the given example.

(ii) WallArea, ColorCode, Type, Advance are directly accessible from the member functions of class paint.

(iii)Billing(), Print(), PBook(), PView(), Book(), View() are directly accessible from an object of class Bill

(iv) When an object of class Bill is declared, the order of execution of the constructors is Exterior(), Paint(), Bill()

Some More Questions From Constructor and Destructor Chapter