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

A milk carton can hold 3.78 litres of milk. Each morning, a dairy farm ships cartons of milk to a local grocery store. The cost of producing one litre of milk is $0.38, and the profit of each carton of milk is $0.27. Write a C++ program that prompts the user to enter the total amount of milk produced in the morning. Then display the number of milk cartons needed to hold milk, the cost of producing milk, and the profit for producing milk.

2 Answers  


what are the events occur in intr activated on interrupt vector table

0 Answers   HGS,


What is Pure Virtual Function? Why and when it is used ?

10 Answers   Lucent, Sona,


WHAT IS THE ABREVATION OF FORTRAN?

4 Answers  


How does the copy constructor differ from the assignment operator (=)?

0 Answers  






What is a flag in c++?

0 Answers  


What are the techniques you use for debugging?

1 Answers   Adtran,


what is polymorphism?

14 Answers   Accenture,


What is a float in c++?

0 Answers  


What is a multiset c++?

0 Answers  


There is a array of 99 cells and we have to enter 1-100 elements in it , no two elements would repeat , so the is one no. missing because 99 cells and 1-100 nos. so we had to implement a function to find that missing no.

2 Answers   Nagarro,


difference between macro and function?

3 Answers  


Categories