46.
Answer the questions (i) to (iv) based on the following:
class Director
{
long DID;
char Name[20];
protected:
char Description[40]:
void Allocate();
public:
Director();
void Assign();
void Show();
}:
class Factory : public Director
{
int FID;
char Address[20];
protected:
int NOE:
public:
Factory();
void Input();
void Output()
}:
class ShowRoom : private Factory
{
int SID:
char City[20];
public:
ShowRoom();
void Enter();
void Display!
}:
(i) Which type of inheritance out of the following is illustrated in the above C++ code?
• Single Level Inheritance
• Multilevel Inheritance
• Multiple Inheritance
(ii) Write the names of data members, which are accessible by objects of class type ShowRoom.
(iii) Write the name of all member functions, which are accessible by objects of class type ShowRoom.
(iv) Write the names of all members, which are accessible from member function of class Factory.
47.
Answer the questions (i) to (iv) based on the following:
class Chairperson
{
long CID;
//Chairperson Identification Number
char Cname[20];
protected:
char Description[40]:
void Allocate();
public:
Chairperson();
void Assign();
void Show();
}:
class Director
{
char profile[30];
public:
Director();
vateFactory();
voidlnput();
void Output();
}:
class Company : private Chairperson, public Director
{
int CID; //Company ID
char City[20], Country[20];
public:
Company();
void Enter();
void Display();
}:
(i) Which type of inheritance out of the following is illustrated in the above C++ code?
• Single Level Inheritance
• Multilevel Inheritance
• Multiple Inheritance
(ii) Write the names of data members, which are accessible by objects of class type Company.
(iii) Write the name of all member functions, which are accessible by objects of class type Company.
(iv) Write the names of all members, which are accessible from member functions of class Director.
48.
Answer the questions (i) to (iv) based on the following:
class QUALITY
{
private:
char Material [30];
float Thickness;
protected:
char Manufacturer[20];
public:
QUALITY();
void Reading();
void Printing();
};
class QUANTITY : public
QUALITY
long Order;
protected:
int Stock;
public:
QUANTITY();
void Read_Data();
void Print_Data();
};
class FABRIC : public QUANTITY
{
int Fabric_code, Cost;
public;
FABRIC();
void Read();
void Show();
};
(i) Write the data members that are accessible by an object of type class FABRIC.
(ii) What type of inheritance is illustrated in the above example?
(iii) Write the names of all the members that can be accessed by the member functions of class FABRIC.
(iv) How many bytes will be required by an object of type FABRIC?
49.
Answer the questions (i) to (iv) based on the following:
class FacetoFace
{
char CenterCode[10];
public:
void Input();
void Output();
};
class Online
{
char Website[50];
public:
void SiteIn();
void SiteOut();
};
class Training : public FacetoFace, private Online
{
long Tcode;
float charge;
int period;
public:
void Register(); void Show();
};
(i) Which type of inheritance is shown in above example?
(ii) Write names of all member functions accessible from Show( ) function of class Training.
(iii) Write names of all members accessible through an object of class Training.
(iv) Is function Output() is accessible in function SiteOut()? Justify your answer.
50.
Answer the questions (i) to (iv) based on the following;
class Regular
{
char SchoolCode[10];
public:
void InRegular();
void OutRegular();
};
class Distance
{
char StudyCenter[5];
public:
void InDistance();
void OutDistance!);
};
class Course : public Regular,
private Distance
{
char Code[5];
float Fees;
int Duration; public:
void InCourse();
void OutCourse();
}:
(i) Which type of inheritance is shown in above example?
(ii) Write names of all member functions accessible from OutCourse( ) function of class Course.
(iii) Write names of all members accessible through an object of class Course.
(iv) Is function InRegular( ) is accessible in function InDistance()? Justify your answer.