(i) Mention the member names which accessible by Myfurniture declared in main() function.
Ans: Data Members: No data member can be called from Myfurniture object.
Member Functions:
Furniture::Read_fur_details()
Furniture::Disp_fur_details()
Sofa::Read_sofa_details()
Sofa::Disp_sofa_details()
Office::Read_office_details()
Office::Didp_office_details()
(ii) what is the size of Myfurniture in bytes?
Ans: 29 Bytes
(iii) Mention the names of functions accessible from the member function Read_office_details() of class office.
Ans:
Furniture::Read_fur_details( )
Furniture::Disp_fur_details( )
Sofa::Read_sofa_details( )
Sofa::Disp_sofa_details( )
Office::Disp_office_details( )
DELHI 2005
2.d. Answer the questions (i) to(iv) based on the following code:4
class Medicine
{
char Category[10];
char Date_of_manufacture[10];
char Company[20];
public: Medicine();
void entermedicinedetails();
void showmedicinedetails();
};
class capsule:public Medicine
{
protected: char capsule_name[30];
char volume_lable[20]; public: float Price;
capsules();
void entercapsuledetails();
void showcapsuledetails();
};
class Antibiotics:public Capsule
{
int Dosage_units; char side_effects[20];
int Use_within_days; public: Antibiotics();
void enterdetails(); void showdetails();
} ;
(i) How many bytes will be required by an object of class Medicines and an object of class Antibiotics respectively?
Ans: Medicine – 40 Bytes Antibiotics Object – 118 Bytes
(ii) Write the names of all the member functions accessible from the object of class Antibiotics.
Ans:
Medicine::entermedicinedetails()
Medicine::showmedicinedetails()
Capsules::entercapsuledetails()
Capsules::showcapsuledetails()
Antibiotics::enterdetails()
Antibiotics::showdetails()
(iii) Write the names of all the members accessible from member functions of class capsules.