COMPUTER SCIENCE 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?

2

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 vehicle
{ int wheels;
protected:
int passenger;
void inputdata(int,int);
void outputdata();
};
class heavy_vehicle:protected vehicle
{
int diesel_petrol;
protected:
int load:
public:
void readdata(int,int);
void writedata();
};
class bus:private heavy_vehicle
{
char make[20];
public:
void fetchdata(char);
void displaydata();
};

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

Ans:

Base class of heavy_vehicle – vehicle
Derived class of heavy_vehincle – bus

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

Ans:

bus::make
heavy_vehicle::load
vehicle::passenger

 

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