What is size of empty class object

Answer Posted / orvaishnavi

The size of an empty class is 1.
Reason - An object of a class should have unique address.
In order for the object to get unique address, the compiler
inserts a dummy type of size 1(least positive value) into
the empty class so the sizeof the class is returned as 1.

Is This Answer Correct ?    5 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is c++ stringstream?

705


What is the default width for ouputting a long integer using the insertion operator?

803


If there are two catch statements, one for base and one for derived, which should come first?

663


Suppose that data is an array of 1000 integers. Write a single function call that will sort the 100 elements data [222] through data [321].

1075


What is the difference between #import and #include?

671






What is DlgProc?

685


What is code reusability in c++?

778


an integer constant must have atleast one a) character b) digit c) decimal point

641


What are the advantage of using register variables?

745


Name the debugging methods that are used to solve problems?

664


If dog is a friend of boy, is boy a friend of dog?

657


Is c++ still being used?

650


What is a class definition?

704


Explain about templates of C++.

781


How do you import payscale data from non SAP to SAP?is it through LSMW or any other way is there?

3296