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
To what does “event-driven” refer?
How much do coding jobs pay?
What is name hiding in c++?
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?
What is operators in c++?
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
What is struct c++?
Which bitwise operator is used to check whether a particular bit is on or off?
How is static data member similar to a global variable?
What is c++ vb?
What are the five basic elements of a c++ program?
How is new() different from malloc()?
Is java based off c++?
Define namespace in c++?
What is the use of 'this' pointer?