Multiple choice technology programming languages

What is the memory of a class that contains niether data members nor member functions ?

  1. 0 bytes

  2. 1 bit

  3. same as sizeof(int)

  4. 1 byte

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

In C++, an empty class has a size of 1 byte to ensure that different instances of the class have distinct memory addresses, which is necessary for pointer arithmetic and identity comparisons.