what is the size of a class which contains no member
variables but has two objects??? is it 1 or 2??
Answers were Sorted based on User's Feedback
Answer / 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 |
Answer / rao
2 (if two objects are empty class) otherwise Note : The
size of class = the size of Data members of the objects +
Size of data members of the Class.
| Is This Answer Correct ? | 0 Yes | 2 No |
Answer / asghar ali chandio
every object will occypy one byte of memory. If objects are
two then Size will be two bytes.
| Is This Answer Correct ? | 5 Yes | 8 No |
How do I use arrays in c++?
How do I download c++?
Explain calling an object's member function(declared virtual)from its constructor?
What is a container class? What are the types of container classes in c++?
Describe the syntax of single inheritance in C++?
Explain Memory Allocation in C/C++ ?
What are the different data types present in C++?
What is the difference between equal to (==) and assignment operator (=)?
Define pre-condition and post-condition to a member function in c++?
Do you know about C++ 11 standard?
0 Answers Agilent, ZS Associates,
What is the best way to take screenshots of a window with c++ in windows?
What is the fastest c++ compiler?