Tuesday, 19 April 2011

Why Sizeof object with empty class is not zero in C++?

My understanding would be creating an object means occupying some memory. No size, no memory, no way to tell it is a object or it is an array of objects in C++. So size of object with empty class should one byte. The value could be 1 or 4 depending on the machine.
I am not sure about C#. It is not difficult to know. I will test tomorrow.

No comments:

Post a Comment