INHERITANCE IN C++ (14)
Answer the questions (i) to (iv) based on the following code:
class Customer
{
int Cust_No;
char Cust_Name[20];
protected:
void Register();
public:
Customer();
void status();
};
class Salesman
{
int Salesman_No;
char Salesman_Name[20];
protected:
float Salary;
public:
Salesman();
void Enter();
void Show();
};
class Shop:private Customer, public Salesman
{
char Voucher_No[10];
char Sales_Data[8];
public:
Shop();
void Sales_Entry();
void Sales_Detail();
};
(i) Which type of Inheritance is shown in the above example?
(ii) Write the names of all hte members which are accessible from belonging objects of class Salesman.
(iii) Write the names of all the members which are accessible from member functions of class Shop.
(iv) How many bytes will be required by an object belonging to class Shop?
class Customer
{
int Cust_No;
char Cust_Name[20];
protected:
void Register();
public:
Customer();
void status();
};
class Salesman
{
int Salesman_No;
char Salesman_Name[20];
protected:
float Salary;
public:
Salesman();
void Enter();
void Show();
};
class Shop:private Customer, public Salesman
{
char Voucher_No[10];
char Sales_Data[8];
public:
Shop();
void Sales_Entry();
void Sales_Detail();
};
(i) Which type of Inheritance is shown in the above example?
(ii) Write the names of all hte members which are accessible from belonging objects of class Salesman.
(iii) Write the names of all the members which are accessible from member functions of class Shop.
(iv) How many bytes will be required by an object belonging to class Shop?
No comments
Post your comments