what is the size of a empty class?
-
What is the size of a empty class If the size of the class is zero what can be the problem with the class? Vikas Amin Embin Technology Bombay
-
What is the size of a empty class If the size of the class is zero what can be the problem with the class? Vikas Amin Embin Technology Bombay
vikas amin wrote:
What is the size of a empty class
1 or (>0)
vikas amin wrote:
If the size of the class is zero what can be the problem with the class?
It cannot be zero.
Jesus Loves:rose:
--Owner Drawn:rose: --Defeat is temporary but surrender is permanent --Jesus is Lord:rose:
-
What is the size of a empty class If the size of the class is zero what can be the problem with the class? Vikas Amin Embin Technology Bombay
first thing... The size of the empty class is 1 if it doesn't contains any member variables else its size is the total bytes required for the variables in that class. second thing... if the class contains atleast one virtual function then its size is 2 bytes without member variables as the object of the class contains the address of the VTABLE. for the existance of the object the class having minimum 1 byte size. Thanks and Regards Laxman FAILURE is the first step towards SUCCESS :cool:
-
first thing... The size of the empty class is 1 if it doesn't contains any member variables else its size is the total bytes required for the variables in that class. second thing... if the class contains atleast one virtual function then its size is 2 bytes without member variables as the object of the class contains the address of the VTABLE. for the existance of the object the class having minimum 1 byte size. Thanks and Regards Laxman FAILURE is the first step towards SUCCESS :cool:
Yeh i checked it IDE but the question is why ? For a class containing only one "char" variable the size of the class is 1 . how??? even if the class is empty its 1 and even if it has a character variable its one? Vikas Amin Embin Technology Bombay
-
What is the size of a empty class If the size of the class is zero what can be the problem with the class? Vikas Amin Embin Technology Bombay
-
Yeh i checked it IDE but the question is why ? For a class containing only one "char" variable the size of the class is 1 . how??? even if the class is empty its 1 and even if it has a character variable its one? Vikas Amin Embin Technology Bombay
that is the trick if class contains any variable the size of the class is the summation of bytes of member variables and if no variables then it's size is 1 byte. and as we know that minimum variable size is 1 byte and those for char variables. Thanks and Regards Laxman FAILURE is the first step towards SUCCESS :cool:
-
What is the size of a empty class If the size of the class is zero what can be the problem with the class? Vikas Amin Embin Technology Bombay
The size of an empty class is non-zero. Otherwise, two empty classes of the same type would have the same address.
"The greatest good you can do for another is not just to share your riches but to reveal to him his own." - Benjamin Disraeli