INHERITANCE IN C++ (5)

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

class Cars
{
char DCode[5];
protecte4d:
float price;
void CalcPrice(float);
public:
Cars();
void CInput();
void CShow();
};
class Jeep:public Cars
{
char Jname[20];
float Weight;
public:
Jeep();
void JInput();
void JShow();
};
class ElectronicCars:public Cars
{
char ECName[20];
char BatteryType[10];
int batteries;
public:
ElectronicCars();
void ECInput();
void ECShow();
};

(i) Which type of inheritance out of the following is illustrated in the above example?
I. single Level Inheritance
II. Multi Level Inheritance
III. Multiple Inheritance
IV. hirarchical Inheritance
(ii) How many bytes will be required ny an object of the class ElectronicCars?
(iii) Write the names of all the data members, which are directly accessible from members functions of the class jeep.
(iv) Write the names of all members functions, which are directly accessible by an object of the ElectronicCars.




No comments

Post your comments

Powered by Blogger.