COMPUTER SCIENCE INHERITANCE

(iii) Name the data member(s) that can be accessed by an object of bus class.

Ans: No data member can be accessed by an object of bus class.

(iv) Is the member function outputdata accessible to the objects of heavy_vehicle class?

Ans: No.

DELHI 1998:

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.

 

CBSE Computer Science Solved Revision Tour By Mr. Ravi Kiran ( [email protected] )