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 is the difference between the parameter to a template and the parameter to a function?

1121


What are friend classes?

1067


What do you know about near, far and huge pointer?

1140


the maximum length of a character constant can be a) 2 b) 1 c) 8

1098


What data encapsulation is in c++?

1156


Does there exist any other function which can be used to convert an integer or a float to a string?

1081


Distinguish between new and malloc and delete and free().

1022


What is the best c++ book?

1268


What is a node class in c++?

1073


what are the characteristics of Class Members in C++?

1044


What is function declaration in c++ with example?

1101


How to allocate memory dynamically for a reference?

1048


Can we make any program in c++ without using any header file and what is the shortest program in c++.

1134


write a corrected statement in c++ so that the statement will work properly. x = y = z + 3a;

1901


What is called array?

1088