In this case, i think we will get sizeof(int) size of class because here the objects will automatically be referring to different memory location because of non-zero class size. Empty class looks like a special case where 'bonus' size is allocated.
On Thu, Jul 7, 2011 at 11:04 AM, oppilas . <jatka.oppimi...@gmail.com> wrote: > Ok. So for differentiating objects, we have size 1. What will be size of > following class:- > class A{ > int z; > }; > How does different objects gets differentiated in above case? > > On Wed, Jul 6, 2011 at 2:24 PM, durgaprasad k <durga...@gmail.com> wrote: >> >> The size will be 1 byte as there is nothing to look into the object. >> And it is 1 instead of zero because two objects of the class will have >> different addresses by assigning each object size 1. >> Regards, >> Durga >> >> On Wed, Jul 6, 2011 at 2:11 PM, Piyush Sinha <ecstasy.piy...@gmail.com> >> wrote: >>> >>> What is the size of an object of a class with no members in it?? >>> -- >>> *Piyush Sinha* >>> *IIIT, Allahabad* >>> *+91-8792136657* >>> *+91-7483122727* >>> *https://www.facebook.com/profile.php?id=100000655377926 * >>> >>> -- >>> You received this message because you are subscribed to the Google Groups >>> "Algorithm Geeks" group. >>> To post to this group, send email to algogeeks@googlegroups.com. >>> To unsubscribe from this group, send email to >>> algogeeks+unsubscr...@googlegroups.com. >>> For more options, visit this group at >>> http://groups.google.com/group/algogeeks?hl=en. >>> >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Algorithm Geeks" group. >> To post to this group, send email to algogeeks@googlegroups.com. >> To unsubscribe from this group, send email to >> algogeeks+unsubscr...@googlegroups.com. >> For more options, visit this group at >> http://groups.google.com/group/algogeeks?hl=en. > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to algogeeks@googlegroups.com. > To unsubscribe from this group, send email to > algogeeks+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > -- Regards, Navneet -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.