What is size of a empty class?
Answers were Sorted based on User's Feedback
Answer / dips
it doesnot take memory just writing class in C++
means i want to say
class d{};
no memory allocation is done here
but is this a empty class?
| Is This Answer Correct ? | 13 Yes | 2 No |
Answer / shiv chidambar
size of empty class is 1 byte.
because to indicate class existance in memory 1 byte is
allocated to indicate that class is present.
if the class is empty then there should some kind of
mechanism to indicate or to show this class is present.
if memory (1 byte) not alloacted such a empty class then how
we know that class is present but in programme that class is
written? so for that 1 byte allocated to indicate class
existance.
this happens only for emty classes(Consider example of
tagging interface in java which is empty class).
| Is This Answer Correct ? | 1 Yes | 0 No |
Answer / mashal
Size of an empty class is 1 byte. It is non zero to ensure that the two different objects will have different addresses.
| Is This Answer Correct ? | 0 Yes | 0 No |
Write a C++ program that asks the user to choose a number between 1 and 1000. Then, your program should be able to guess the number by asking the user no more than 10 yes/no questions. Use a while loop in your program
Differences between private, protected and public and give examples.
How many pointers are required to reverse a link list?
What is c++ hash?
Difference between class and structure.
How are Structure passing and returning implemented by the compiler?
How many bit combinations are there in a byte?
What is encapsulation in C++? Give an example.
0 Answers HAL, Honeywell, Zomato,
Write my own zero-argument manipulator that should work same as hex?
Why do we use double in c++?
Can circle be called an ellipse?
Describe run-time type identification?