what is the size of an empty class

Answers were Sorted based on User's Feedback



what is the size of an empty class..

Answer / hardit singh

size of an empty class is 1 byte

Is This Answer Correct ?    32 Yes 3 No

what is the size of an empty class..

Answer / muniskehar

size of an empty class is 1Byte

Is This Answer Correct ?    7 Yes 1 No

what is the size of an empty class..

Answer / manu

1 byte it 100% correct ans dont get confuse

Is This Answer Correct ?    5 Yes 2 No

what is the size of an empty class..

Answer / 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

what is the size of an empty class..

Answer / asdf

According to the standard C++03, all classes "shall have
nonzero size."

1 byte is the most common implementation but it is left up
to the vendor.

Is This Answer Correct ?    2 Yes 0 No

what is the size of an empty class..

Answer / padma

Size of an empty class is 0.

Is This Answer Correct ?    0 Yes 0 No

what is the size of an empty class..

Answer / ankit sharma

size of empty class is 1 byte.


if object does not point to any resource.
it shows object is null but object also get some space in
memory by default either it is empty or not.

Is This Answer Correct ?    0 Yes 0 No

what is the size of an empty class..

Answer / ansari razi

1 Byte,
when compiling the program compiler allocates 1 byte memory.

Is This Answer Correct ?    0 Yes 0 No

what is the size of an empty class..

Answer / kaush

1 byte for empty class before assigning the value

Is This Answer Correct ?    0 Yes 1 No

what is the size of an empty class..

Answer / p.madhupriya

1 byte or 0

Is This Answer Correct ?    1 Yes 2 No

Post New Answer

More OOPS Interview Questions

What is static in oop?

0 Answers  


what's the basic's in dot net

0 Answers   informatics,


What is ambiguity in inheritance?

0 Answers  


What is polymorphism oop?

0 Answers  


what is difference between c++ language and java language

5 Answers  






char* ptr = "Rahul"; *ptr++; printf("%s",ptr); What will be the output

9 Answers   Persistent,


What are the advantanges of modularity

2 Answers  


Question In a class, there is a reference or pointer of an object of another class embedded, and the memory is either allocated or assigned to the new object created for this class. In the constructor, parameters are passed to initialize the data members and the embedded object reference to get inialized. What measures or design change should be advised for proper destruction and avioding memory leaks, getting pointers dangling for the embedded object memory allocation? Please suggest. Question Submitted By :: Sunil Kumar I also faced this Question!! Rank Answer Posted By Re: In a class, there is a reference or pointer of an object of another class embedded, and the memory is either allocated or assigned to the new object created for this class. In the constructor, parameters are passed to initialize the data members and the embedded object reference to get inialized. What measures or design change should be advised for proper destruction and avioding memory leaks, getting pointers dangling for the embedded object memory allocation? Please suggest. Answer # 1 use copy constructors 0 Shanthila There is something to be taken care in destructor, in copy constructor, suppose the memory is assigned to the embedded member object pointer with the parameter passed value, but if some other objects of different class also are pointing to this memory, then if some one deletes the object then this class member pointer object will become dangling, or if the object is not deleted properly then there will be memory leak. Please suggest the design change required to handle or avoid this situation

0 Answers   TCS,


What is the difference between a constructor and a destructor?

0 Answers  


Can main method override?

0 Answers  


How to reverse a sentence in c program ex: ram is a good boy answer: boy good a is ram

0 Answers   IBM,


Why is there no multiple inheritance?

0 Answers  


Categories