what is the size of a class which contains no member
variables but has two objects??? is it 1 or 2??
Answer Posted / vasanth
class a
{
};
void main()
{
a obj1;
a obj2;
cout<<"sizeof class = "<<sizeof(a)<<endl<<"sixeof
obj1 = "<<sizeof(obj1)<<endl<<"sixeof obj2 = "<<sizeof(obj2)
<<endl;
}
--------------------
always sizeof the empty class is 1 byte and each object it
will tak 1 byte.
Is This Answer Correct ? | 6 Yes | 0 No |
Post New Answer View All Answers
Write about all the implicit member functions of a class?
What is the use of dot in c++?
Is c++ the hardest language?
What is the limitation of cin while taking input for character array?
List down the guideline that should be followed while using friend function.
What are the differences between malloc() and calloc()?
How can you specify a class in C++?
How many namespaces are there in c++?
How a new element can be added or pushed in a stack?
What are maps in c++?
How can a called function determine the number of arguments that have been passed to it?
What are the differences between the function prototype and the function defi-nition?
What is a pdb file?
How do I start a c++ project?
What is runtime errors c++?