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 does ctime() do?
Write a program to find the Factorial of a number
What jobs can you get with a c++ certification?
What is protected inheritance?
What are the advantages of using a pointer? Define the operators that can be used with a pointer.
What are move semantics?
What is the difference between = and == in C?
20 Answers Christ University, Intel,
What is the operator in c++?
. If employee B is the boss of A and C is the boss of B and D is the boss of C and E is the boss of D. Then write a program using the Database such that if an employee name is Asked to Display it also display his bosses with his name. For eg. If C is displayed it should also display D and E with C?
What is a class definition?
What is constant in c++ with example?
What are manipulators in c++ with example?