----------------------------------------------------------- New Message on BDOTNET
----------------------------------------------------------- From: venkat Message 6 in Discussion Hi Sujay, Class do not by itself have any size when you use sizeof (object), but default value depends on what type of compiler you are using. The C++ standard requires that all classes be at least 1 byte to of length. Like How VC++ editor showing. If you take same class use in Borland will give Zero (0) bytes length and more some compiler will give 2 byte of length. These all are depends on compiler what you are using. Thanks Venkat. -----Original Message----- From: Sujay [mailto:[EMAIL PROTECTED] Sent: Monday, July 21, 2003 7:09 PM To: BDOTNET Subject: [OT] -- sizeof operator question New Message on BDOTNET [OT] -- sizeof operator question Reply Reply to Sender Recommend Message 1 in Discussion From: Sujay Hello Users , I am posting an off topic question I have an empty class, like below :- class MyClass { // Nothing }; int main( ) { MyClass obj; int nSize = sizeof(obj); cout << size << endl ; // The value gets printed as 1 } Though the class is empty , the sizeof operator returns 1. My question is WHY ? On the other hand if I declare a int member variable in the class, sizeof returns the value of the int only. Any help would be appreciated . Sujay Sujay Ghosh iGATE Global Solutions Ltd., ( formerly known as Mascot Systems Ltd.), No.1, Main Road , Jakkasandra , Off Sarjapur Road , Koramangala Extn . Bangalore - 560 034 Mail : [EMAIL PROTECTED] Phone : + 91 - 080 - 552 - 1701 - 06 ( Extn : 5010) Fax : 91-080-5521704 Mobile : 98454 67789 View other groups in this category. ----------------------------------------------------------- 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]
