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

write a program that takes two numbers from user that prints the smallest number

2 Answers  


Will the following program execute?

0 Answers  


What is the difference between mutex and binary semaphore?

0 Answers  


Define a conversion constructor?

0 Answers  


How const functions will be treated by compiler?

3 Answers   Symphony,






What is decltype c++?

0 Answers  


What sorting algorithm does c++ use?

0 Answers  


Write a program which uses functions like strcmp(), strcpy()? etc

0 Answers  


Which bit wise operator is suitable for putting on a particular bit in a number?

0 Answers  


Explain how functions are classified in C++ ?

0 Answers  


What is the latest c++ version?

0 Answers  


Can you please explain the difference between static and dynamic binding of functions?

0 Answers  


Categories