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

catch(exception &e) { . . . } Referring to the sample code above, which one of the following lines of code produces a written description of the type of exception that "e" refers to? a) cout << e.type(); b) cout << e.name(); c) cout << typeid(e).name(); d) cout << e.what(); e) cout << e;

2 Answers   Quark,


what is static function

2 Answers   Patni,


What is problem with overriding functions?

0 Answers  


What is one dimensional array in c++?

0 Answers  


What's c++ used for?

0 Answers  






What is the protected keyword used for?

0 Answers  


How do you flush a buffer in c++?

0 Answers  


Explain overriding.

0 Answers  


Differentiate between late binding and early binding. What are the advantages of early binding?

0 Answers  


How to implement flags?

2 Answers   Symphony,


What does catch(…) mean?

0 Answers  


Is C++ case sensitive a) False b) Depends on implementation c) True

0 Answers  


Categories