COMPUTER SCIENCE 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;
}

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


CBSE Computer Science Solved Revision Tour By Mr. Ravi Kiran ( mrkdata@yahoo.com )


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

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/inheritance5.php on line 190

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

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/inheritance5.php on line 192