-----------------------------------------------------------

New Message on BDOTNET

-----------------------------------------------------------
From: Ramesh
Message 7 in Discussion

Hi Sujay,     As you have mentioned the sizeof() operator for an empty class returns 1 
byte.This is because every object you create should be created in a new address 
space.Hence addresses of two different objects are different and "new" always returns 
pointers to distinct objects.   ex: class Empty {   };   void main() {    Empty 
Obj1,Obj2;    Empty* ptr1 = new Empty;    Empty* ptr2 = new Empty; }   //Here 
Obj1,Obj2,ptr1,ptr2 are all created in a different address space.Hence it should have 
some size and the minimum possible size is 1.Hence the answer.     But when you 
declare class member variables,the sizeof() an object of such a class would be the sum 
of the size's of all the class member variables.    This is one of the favorite 
interview questions on C++ :)....   Regards, Ramesh

-----------------------------------------------------------

To stop getting this e-mail, or change how often it arrives, go to your E-mail 
Settings.
http://groups.msn.com/bdotnet/_emailsettings.msnw

Need help? If you've forgotten your password, please go to Passport Member Services.
http://groups.msn.com/_passportredir.msnw?ppmprop=help

For other questions or feedback, go to our Contact Us page.
http://groups.msn.com/contact

If you do not want to receive future e-mail from this MSN group, or if you received 
this message by mistake, please click the "Remove" link below. On the pre-addressed 
e-mail message that opens, simply click "Send". Your e-mail address will be deleted 
from this group's mailing list.
mailto:[EMAIL PROTECTED]

Reply via email to