Chapter – 6. INHERITANCE

(iii) Name the private member function(s) of class Teacher.

Ans: Teacher::Display( )

(iv) Is the member function OUT() accessible the objects of Dept?

Ans: Yes. Since it is public member function.

DELHI 1999

2.a. What do you understand by visibility modes in class derivations? What are these modes?

Ans: It is given in chapter 4, classes and object as two answers. Ie Difference between private and protected, private and public.

2.c. Consider the following declarations and answer the questions below:
class PPP
{
int H;
protected:
int S;
public:
void INPUT(int);
void OUT();
};
class QQQ:private PPP
{
int T;
protected:
int U;
public:
void INDATA(int,int);
void OUTPUT(); };
class RRR:public QQQ
{
int M;
public:
void DISP(void);
};

(i) Name the base class and derived class of the class QQQ.

Ans: Base class of QQQ – PPP Derived class of QQQ – RRR

(ii) Name the data member(s) that can be accessed from function DISP().

Ans: QQQ::U , RRR::M

(iii) Name the member function(s) , which can be accessed from the object of class RRR.

Ans: QQQ::INDATA( ) QQQ::OUTPUT( ) RRR::DISP( )

(iv) Is the member function OUT() accessible by the objects of the class QQQ?

Ans: No.