INHERITANCE IN C++ (11)
Answer the questions (i) to (iv) based on the following code.
class Stationary
{
char Type;
char Manufacturer[10];
public:
Stationary();
void Read_sta_details();
void Disp_sta_derails();
};
class Office: public Stationary{
{
int No_of_types;
float Cost_of_sta;
public:
void Read_off_details();
vod Disp_off_details();
};
class Printer:private Offie
{
int No_of_users;
char Delivery_date();
public:
void Read_pri_details();
void Disp_pri_details();
};
(i) Which type of inheritance is illustrated by the above example?
(ii) Write the names of all data members which are accessible from the objects belonging to class Printer.
(iii) Mention the names of functions accessible from the member function Read_pri_details() of class Printer.
(iv) Write down the names of data members accessible in the Read_off_details() function of Office class.
class Stationary
{
char Type;
char Manufacturer[10];
public:
Stationary();
void Read_sta_details();
void Disp_sta_derails();
};
class Office: public Stationary{
{
int No_of_types;
float Cost_of_sta;
public:
void Read_off_details();
vod Disp_off_details();
};
class Printer:private Offie
{
int No_of_users;
char Delivery_date();
public:
void Read_pri_details();
void Disp_pri_details();
};
(i) Which type of inheritance is illustrated by the above example?
(ii) Write the names of all data members which are accessible from the objects belonging to class Printer.
(iii) Mention the names of functions accessible from the member function Read_pri_details() of class Printer.
(iv) Write down the names of data members accessible in the Read_off_details() function of Office class.
No comments
Post your comments