Answer Posted / orvaishnavi
The size of an empty class is 1.
Reason - An object of a class should have unique address.
In order for the object to get unique address, the compiler
inserts a dummy type of size 1(least positive value) into
the empty class so the sizeof the class is returned as 1.
Is This Answer Correct ? | 5 Yes | 0 No |
Post New Answer View All Answers
What is the disadvantage of using a macro?
What is std :: endl?
What are smart pointers?
Differentiate between an inspector and a mutator ?
Are vectors faster than arrays?
What are virtual functions in c++?
Does a derived class inherit or doesn't inherit?
How can an improvement in the quality of software be done by try/catch/throw?
Does c++ vector allocate memory?
What is the insertion operator and what does it do?
Can I have a reference as a data member of a class? If yes, then how do I initialise it?
Can you sort a set c++?
What is the difference between global variables and local variable
Is c++ double?
When should we use container classes instead of arrays?