Topic Wise Solved Problems Question – Computer Sir Ki Class

Login


Lost your password?

Don't have an account ?
Register (It's FREE) ×
  


Shop
siteicon
CPP: Topicwise Exam Question: mult-level-inheritance siteicon
02D 4

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

class One
{
  int A1;
protected:
  float A2;
public:
  One();
  void Get1(); void Show1();
};
class Two : private One
{
  int B1;
protected:
  float B2;
public:
  Two();
  void Get2();
  void Show();
};
class Three : public Two
{
  int C1;
public:
  Three();
  void Get3();
  void Show();
};
void main()
{
  Three T;     //Statement 1
  __________________;  //Statement 2
}

(i) Which type of Inheritance out of the following is illustrated in the above example?
-Single Level Inheritance, Multilevel Inheritance, Multiple Inheritance

(ii) Write the names of all the member functions, which are directly accessible by the object T of class Three as declared in main() function.

(iii) Write Statement 2 to call function Show() of class Two from the object T of class Three.

(iv) What will be the order of execution of the constructors, when the object T of class Three is declared inside main()?

CBSE12D-2017

02D 4

Answer the question (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?

CBSE12D-2015

02D 4

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

class First
{
  int X1;
protected:
  float X2;
public:
  First();
  void Enter1(); void Display1();
};
class Second : private First
{
  int Y1;
protected:
  float Y2;
public:
  Second();
  void Enter2();
  void Display();
};
class Third : public Second
{
  int Z1;
public:
  Third();
  void Enter3();
  void Display();
};
void main()
{
  Third T;           //Statement 1
__________________;  //Statement 2
}

(i) Which type of Inheritance out of the following is illustrated in the above example? Single Level Inheritance, Multilevel Inheritance, Multiple Inheritance

(ii) Write the names of all the member functions, which are directly accessible by the object T of class Third as declared in main() function.

(iii) Write Statement 2 to call function Display() of class Second from the object T of class Third.

(iv) What will be the order of execution of the constructors, when the object T of class Third is declared inside main()?

CBSE12A-2017

02D-2015 4

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?

CBSE12A-2015