What is the size of an empty class in C++ and Java? Why is it not zero? sizeof(); returns 1 in the case of C++.
sizeof();
Because every C++ object needs to have a separate address, it isn't possible to have a class with zero size (other than some special cases related to base classes). There is more information in C++: What is the size of an object of an empty class? .