What is size of Empty Class?
Answers were Sorted based on User's Feedback
Answer / 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 |
Answer / saket kale
when i tried to calculate the size of an empty class that
time i found that it takes 1 byte.which is the size of a
char.That might be the memory taken by the compiler for
storing the address of a empty class.
| Is This Answer Correct ? | 2 Yes | 0 No |
What is a sequence in c++?
Describe the syntax of single inheritance in C++?
what is Loop function? What are different types of Loops?
When is the copy constructor called?
How are pointers type-cast?
Is linux written in c or c++?
In how many ways we can initialize an int variable in C++?
What is the basic structure of a c++ program?
Describe new operator and delete operator?
1.Between 100 and 999 are some numbers that have the characteristics that if you cube the individual digits and sum together you will get the same number. 2. A program that can accept as input an integer and output the equivalent of that number in words.
Write any small program that will compile in "C" but not in "C++"?
How would you obtain segment and offset addresses from a far address of a memory location?