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


Please Help Members By Posting Answers For Below Questions

To what does “event-driven” refer?

821


How much do coding jobs pay?

759


What is name hiding in c++?

872


Can you be able to identify between straight- through and cross- over cable wiring? And in what case do you use straight- through and cross-over?

837


What is operators in c++?

787


declare an array of structure where the members of the structure are integer variable float variable integer array char variable access all elements of the structure using dot operator and this pointer operator

2033


What is struct c++?

746


Which bitwise operator is used to check whether a particular bit is on or off?

802


How is static data member similar to a global variable?

832


What is c++ vb?

835


What are the five basic elements of a c++ program?

828


How is new() different from malloc()?

843


Is java based off c++?

721


Define namespace in c++?

832


What is the use of 'this' pointer?

1016