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
Explain the advantages of using friend classes.
What is the c++ programming language used for?
Write some differences between an external iterator and an internal iterator?
How delete [] is different from delete?
Explain the differences between private, public and protected and give examples.
What is called array?
Is swift faster than c++?
What is while loops?
What are default parameters? How are they evaluated in c++ function?
What is flush c++?
why is iostream::eof inside a loop condition considered wrong?
how to explain our contribution in the project?
How do you initialize a string in c++?
Why do we need constructors in c++?
What do you mean by late binding?