What is size of a object of following class?
class Foo
{
public:
void foo(){}
}

Answers were Sorted based on User's Feedback



What is size of a object of following class? class Foo { public: void foo(){} }..

Answer / sirama

Size of the Object 1 Byte (ie) 8 bits. Because that is
minimum possible size required to allocate something on
memory.

Say If a Create the Object like Foo obj;
Something needs to loaded on Stack. But, actually it does
not have any internal data memebers. Hence, the minimum
possible is 1 Byte.

Is This Answer Correct ?    5 Yes 0 No

What is size of a object of following class? class Foo { public: void foo(){} }..

Answer / jitendra varshney

The size of the object here will be 1. Because by default,
if no variable is declared in the class the size of object is 1.
this is due to fact that when two or more object of the
class is defined then they would have the different
addresses. But if size would have been zero then it might be
possible that two or more object can have the same address.

Is This Answer Correct ?    1 Yes 1 No

Post New Answer

More C++ General Interview Questions

How do you differentiate between overloading the prefix and postfix increments?

1 Answers  


What is the auto keyword good for in c++?

1 Answers  


What is the rule of three?

1 Answers  


write the programme that convert a interger to biniry number

1 Answers   Amazon,


What is type of 'this' pointer?

1 Answers  


What is size_type?

1 Answers  


I want explanation for this assignment: how to connect mysql database using c/c++,please explain this detailly?

1 Answers  


Under what conditions is multiple inheritance not recommended?

1 Answers  


What is size of a object of following class? class Foo { public: void foo(){} }

2 Answers   CA,


What character terminates all character array strings a) b) . c) END

0 Answers  


What do you mean by function and operator overloading in c++?

1 Answers  


Write a program using shift_half( ) function to shift the elements of first half array to second half and vice versa.

1 Answers  


Categories