Inheritance (Extending Classes)
Answer the questions (i) to (iv) based on the following:
class COMPANY
{
char Location[20]; double Budget,Income;
protected:
void Accounts( ); public:
COMPANY();
void Register( ); void Show( );
};
class FACTORY: public COMPANY
{
char Location[20];
int Workers;
protected:
double Salary;
void Computer();
public:
FACTORY();
void Enter( );
void show( );
};
class SHOP: private COMPANY
{
char Location[20];
float Area;
double Sale;
public:
SHOP();
void Input();
void Output();
};
(i) Name the type of inheritance illustrated in the above C++ code. |
(ii) Write the names of data members, which are accessible from member functions of class SHOP. |
(iii) Write the names of all the member functions, which are accessible from objects belonging to class FACTORY. |
(iv) Write the names of all the members, which are accessible from objects of class SHOP. |
Sponsor Area
Sponsor Area
Sponsor Area