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
Which is best c++ or java?
Why is that unsafe to deal locate the memory using free( ) if it has been allocated using new?
What are the main features of c++?
Explain the isa and hasa class relationships.
What is abstraction in c++ with example?
What is a pointer how and when is it used?
Explain explicit container.
When we use Abstract Class and when we use Interface?where we will implement in real time?
Explain the benefits of proper inheritance.
How compile and run c++ program in turbo c++?
What do you mean by public protected and private in c++?
What is c++ stringstream?
What is the error in the code below and how should it be corrected?
What is an object in c++?
Is c++ still in demand?