Size of an empty class why 1 byte ?

V

Victor Bazarov

Sweety said:
why sizeof an empty class why 1 byte ?

Because if it weren't there would be no way to
distinguish between different objects in an array.

V
 
R

rossum

hello,
why sizeof an empty class why 1 byte ?

plz illustrate this ?
bye

Everything must have a different address in memory, otherwise there
are big possibilities for confusion with pointers, references and
suchlike. Hence even an empty class takes up one byte so the next
thing you declare will have a different address.

rossum
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,527
Members
44,999
Latest member
MakersCBDGummiesReview

Latest Threads

Top