Chapter – 6. INHERITANCE

(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.


Warning: include_once(../../ebooks-footer19.php): Failed to open stream: No such file or directory in /home/cbseguess/public_html/ebooks/xii/coumputer-science/chapter6_e.php on line 134

Warning: include_once(): Failed opening '../../ebooks-footer19.php' for inclusion (include_path='.:/opt/cpanel/ea-php83/root/usr/share/pear') in /home/cbseguess/public_html/ebooks/xii/coumputer-science/chapter6_e.php on line 134

Warning: include_once(../../../footer19.php): Failed to open stream: No such file or directory in /home/cbseguess/public_html/ebooks/xii/coumputer-science/chapter6_e.php on line 136

Warning: include_once(): Failed opening '../../../footer19.php' for inclusion (include_path='.:/opt/cpanel/ea-php83/root/usr/share/pear') in /home/cbseguess/public_html/ebooks/xii/coumputer-science/chapter6_e.php on line 136