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
Can circle be called an ellipse?
What apps are written in c++?
Explain friend class?
Will c++ be replaced?
How the delete operator differs from the delete[]operator?
Which function should be used to free the memory allocated by calloc()?
Is string data type in c++?
Why is that unsafe to deal locate the memory using free( ) if it has been allocated using new?
What is searching?
What is an accessor in c++?
What is std :: flush?
How we can differentiate between a pre and post increment operators during overloading?
What is the function of I/O library in C++ ?
What is iomanip c++?
What is a c++ object?