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 |
Explain how functions are classified in C++ ?
how many trys can we write in one class
What are the manipulators in c++?
What is constructor and destructor in c++?
What are the different types of polymorphism in c++?
Is std :: string immutable?
Write down the equivalent pointer expression for referring the same element a[i][j][k][l]?
Reverse the Linked List. Input: 1->2->3->4->5->NULL Output: 5->4->3->2->1->NULL
string somestring ; Which of the following choices will convert a standard C++ string object "somestring" to a C string? a) Copy.somestring () ; b) somestring.c_str () c) &somestring [1] d) std::cstring (somestring) e) (char *) somestring
Can we define function inside main in c++?
Define a constructor - what it is and how it might be called (2 methods)?
What is the Difference between "C structure" and "C++ structure"?