+1 vote
in Class 12 by kratos

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

class indoor_sports

{

int i_id;

char i_name[20];

char i_coach[20];

protected:

int i_rank,i_fee;

void get_ifee();

public:

indoor_sports();

void iEntry();

void ishow();

};

class outdoor_sports

{

int o_id;

char o_name[20];

char o_coach[20];

protected:

int orank,ofee;

void get_ofee();

public:

outdoor_sports();

void oEntry();

void oshow();

};

class sports:public indoor_sports,protected outdoor_sports

{

char rules[20];

public:

sports();

void registration();

void showdata();

};

(i) Name the type of inheritance illustrated in the above C++ code.

(ii) Write the names of all the members, which are accessible from the objects belonging to class outdoor_sports.

(iii) Write the names of all the member functions, which are accessible from the member function of class sports.

(iv) What will be the size of the object belonging to class indoor_sports?

1 Answer

+4 votes
by kratos
 
Best answer

(i) Multiple Inheritance

(ii) Data Members:

Member Functions: oEntry(), oShow()

(iii) registration(), showdata(), oEntry(), oShow(), get_ofee(), iEntry(), iShow(), get_ifee()

(iv) 46 Bytes

...