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

Explain about Virtual Function in C++?

1016


Define 'std'.

1173


Describe private, protected and public – the differences and give examples.

1188


How does class accomplish data hiding in c++?

1165


How do I exit turbo c++?

1066


In what situations do you have to use initialization list rather than assignment in constructors?

1055


What is prototype for that c string function?

1126


Do you know about C++ 11 standard?

1084


Why do we use classes in c++?

1054


Explain the use of virtual destructor?

1075


How can you quickly find the number of elements stored in a a) static array b) dynamic array ? Why is it difficult to store linked list in an array?how can you find the nodes with repetetive data in a linked list?

1281


What is an iterator?

1189


Which is better c++ or java?

976


Define the process of error-handling in case of constructor failure?

1012


What is wrapper class in c++?

1109