Adobe Interview Question
Software Engineer / DevelopersTeam: c++
Country: India
Interview Type: In-Person
@Avenger default size for class with no body shold be always 1 .
plz try to compile & execute it ?
Hi,,,,
This program will give output 1;
Why?? Because the class object c has no access to the structure and thus no memory is allocated for the structures entity and the default size of class is 1.
If we declare the object of structure then it will show output as 4, even if we again leave the constructor blank. Compile and run to check it out.
One the structure definition is there. But no component is there. So it behaves as an empty class. So size of an empty class is always 1.
- Psycho August 29, 2012