Why is the size of an empty class in C++ not zero?
c++, sizeof
Solution
The standard does not allow objects (and classes thereof) of size 0, since that would make it possible for two distinct objects to have the same memory address. That's why even empty classes must have a size of (at least) 1.
Problem
Possible Duplicate: C++: What is the size of an object of an empty class? Why does the following output `1`? ``` #include <iostream> class Test { }; int main() { std::cout << sizeof(Test); return 0; } ```