DIGIT-ARC read-only archive · snapshot: July 23, 2026

c++

12 posts · originally from https://geek.digit.in/community/threads/c.36547/

Official Techie
Official Techie Original post #1
Sep 16, 2006 at 4:25 PM
class stationary
{
char type;
char manufacturer[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;
}

what is the size of Myprinter in bytes ??
Official Techie
Sep 20, 2006 at 4:30 AM
no no u did not got the point the prog which i had written has come in 2005 board exams how can i write it in computer then i want to know as it is
varkey
varkey #4
Sep 20, 2006 at 6:16 AM
i think its 30 bytes


edit : its 29 bytes. counted the first char as 2 bytes.
romeo_8693
Sep 20, 2006 at 7:36 PM
ooops!! yup its 29 bytes......
altimate
Sep 21, 2006 at 3:41 PM
(1+10)+(2+4)+(2+10)=29 bytes
and bingo!!!!!!!!!!
Official Techie
Sep 21, 2006 at 4:23 PM
3 answers which one is correct whats the funda aise hi chalta raha to computer ke exam mein to pakka fail ho jaonga boards mein
ilugd
ilugd #8
Sep 21, 2006 at 6:44 PM
LOL. Ever tried running that code ms123 posted?
mod-the-pc
Sep 21, 2006 at 9:43 PM
Its 12 bytes. Note that private members are not inherited
casanova
casanova #10
Sep 22, 2006 at 2:49 AM
Yup, it is 12 bytes.
varkey
varkey #11
Sep 22, 2006 at 6:01 PM
as "altimate" said its 29 bytes. eventhough some are private members they are accessible thru the functions which are inherited.
mod-the-pc
Sep 23, 2006 at 9:26 PM
varkey said:
as "altimate" said its 29 bytes. eventhough some are private
members they are accessible thru the functions which are inherited.
Yes I tested this and its 29 bytes. But I'm still not sure how the members that are not inherited add to the size of the derived class...:confused: