Chapter – 6. INHERITANCE

2.d. Answer the questions (i) to(iv) based on the following code

class stationary
{
char Type;
char Manufacture[10];
public: stationary( );
void Read_sta_details( );
void Disp_sta_details( );
};
class office:public stationary
{
int no_of_types;
float cost_of_sta;
public: void Read_off_details( );
void Disp_off_details( );
};
class printer:private office
{
int no_of_users;
char delivery_date[10];
public: void Read_pri_details( );
void Disp_pri_details( );
};
void main( )
{
printer MyPrinter;
}

(i) Mention the member names which are accessible by MyPrinter declared in main() function.

Ans: printer::Read_pri_details( ); printer::Disp_pri_details( );

(ii) What is the size of MyPrinter in bytes?

Ans: 29 Bytes

(iii) Mention the names of functions accessible from the member function Read_pri_details() of class printer.

Ans:

stationary::Read_sta_details( )
stationary::Disp_sta_details( )
office::Read_off_details( )
office::Disp_off_details( )
printer::Disp_pri_details( )

OUT SIDE DELHI 2006

2.d. Answer the questions (i) to(iv) based on the following code:4

class furniture
{
char Type;
char Mode[10];
public: furniture( );
void Read_fur_details();
void Disp_fur_details();
};
class sofa:public furniture
{
int no_of_seats;
float cost_sofa;
public: void Read_sofa_details();
void Disp_sofa_details();
};
class office:public sofa
{
int no_of_pieces;
char delivery_date[10];
public: void Read_office_details();
void Didp_office_details();
};
void main()
{
office MyFurniture;
}


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_d.php on line 147

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_d.php on line 147

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

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_d.php on line 149