what is the size of an empty class
Answers were Sorted based on User's Feedback
Answer / som shekhar
1 byte.
Reason being when compiler sees an empty class then then it
assigns a 1 byte memory, since the compiler sees the
declaration of the class so he needs to assign some space in
the memory, and hence assign 1 byte memory to hold the
address of the class.
| Is This Answer Correct ? | 4 Yes | 1 No |
Answer / asdf
According to the standard C++03, all classes "shall have
nonzero size."
1 byte is the most common implementation but it is left up
to the vendor.
| Is This Answer Correct ? | 2 Yes | 0 No |
Answer / ankit sharma
size of empty class is 1 byte.
if object does not point to any resource.
it shows object is null but object also get some space in
memory by default either it is empty or not.
| Is This Answer Correct ? | 0 Yes | 0 No |
Answer / ansari razi
1 Byte,
when compiling the program compiler allocates 1 byte memory.
| Is This Answer Correct ? | 0 Yes | 0 No |
Answer / kaush
1 byte for empty class before assigning the value
| Is This Answer Correct ? | 0 Yes | 1 No |
What is Virtual Keyword?
1. Wrie a function which returns the most frequent number in a list of integers. Handle the case of more than one number which meets this criterion. public static int[] GetFrequency(int[] list)
Is enum a class?
what is the definition of incapsulation
What is difference between #define and const?
What do you mean by public, private, protected and friendly?
What is difference between pop and oop?
write a program to find 2^n+1 ?
i have to create a view in SQL as like in ORACLE DATA EXPRESS EDITION
IN PROGRAMING LANGAUGE A C++ IS PURELY OBJECT ORIENTED OR NOT?
How is class defined?
how to create thread in java?
17 Answers IBM, Infosys, Wipro,