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 bubble sorting.
What does new return if there is insufficient memory to make your new object?
What is a c++ map?
How to allocate memory dynamically for a reference?
What are vectors used for in c++?
What is a namespace in c++?
What is the best c++ compiler for windows 10?
What does the nocreate and noreplace flag ensure when they are used for opening a file?
How the memory management in vectors are being done. What happens when the heap memory is full, and how do you handle it ?
What is runtime polymorphism in c++?
What is c++ iterator?
What do manipulators do?
State the difference between delete and delete[].
What is #include cstdlib in c++?
Difference between class and structure.