what is the size of an empty class

Answer Posted / som shekhar

1 byte.

Reason being when compiler sees an empty class then then it
assigns a 1 byte memory, since the compiler sees the
declaration of the class so he needs to assign some space in
the memory, and hence assign 1 byte memory to hold the
address of the class.

Is This Answer Correct ?    4 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is oops in simple words?

585


How can you overcome the diamond problem in inheritance?

772


What is a class in oop?

608


What is the problem with multiple inheritance?

588


Can main method override?

589






Is enum a class?

607


What is class and object in oops?

615


What is protected in oop?

606


Templates mean

1592


What is cohesion in oop?

624


Are polymorphisms mutations?

707


when to use 'mutable' keyword and when to use 'const cast' in c++

1653


What exactly is polymorphism?

612


Why do we use polymorphism?

583


What is polymorphism give a real life example?

566