Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

What is size of a empty class?

Answer Posted / shiv chidambar

size of empty class is 1 byte.
because to indicate class existance in memory 1 byte is
allocated to indicate that class is present.

if the class is empty then there should some kind of
mechanism to indicate or to show this class is present.
if memory (1 byte) not alloacted such a empty class then how
we know that class is present but in programme that class is
written? so for that 1 byte allocated to indicate class
existance.
this happens only for emty classes(Consider example of
tagging interface in java which is empty class).

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What does return 0 do in c++?

971


What is a constant reference?

1014


What are the uses of pointers?

1020


What are the three forms of cin.get() and what are their differences?

1150


What is the keyword auto for?

989


Which of the following is evaluated first: a) && b) || c) !

2301


Can a constructor be private?

1017


Why is the function main() special?

1039


What doescout<<(0==0) print out a) 0 b) 1 c) Compiler error: Lvalue required

929


Can we overload operator in c++?

975


What are the differences between java and c++?

1002


What does namespace mean in c++?

1030


What are the restrictions apply to constructors and destructors?

1028


Is swift faster than go?

1040


Explain some examples of operator overloading?

1031