What is size of Empty Class?

Answer Posted / amit basak

The size of the class will be 1 byte as mentioned by Rahul...
Here is the below code in Cygwin ...

// This program is to find the size of empty class

#include<iostream>

using namespace std;

class Demo
{

};

int main ()
{
cout <<"Sizeof Demo class is ="<<sizeof(Demo)<<endl;

return(0);
}


And here is the output..
$ ./a.exe
Sizeof Demo class is =1

Is This Answer Correct ?    14 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain the differences between list x; & list x();.

598


What is an iterator class in c++?

597


How one would use switch in a program?

611


What is heap sort in c++?

597


How can I learn dev c++ programming?

563






What are the various storage classes in C++?

646


List the issue that the auto_ptr object handles?

609


How can you create a virtual copy constructor?

580


What is meant by entry controlled loop? What all C++ loops are exit controlled?

561


What is the v-ptr?

637


How much do coding jobs pay?

549


What are vectors used for in c++?

617


what is multi-threading in C++?

611


Which is the best c++ compiler?

585


Distinguish between new and malloc and delete and free().

573