What is size of a empty class?
Answer Posted / 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 |
Post New Answer View All Answers
Difference between strdup and strcpy?
What is the difference between public, private, and protected access?
How do you establish an is-a relationship?
What is abstraction c++?
Tell me difference between constant pointer and pointer to a constant.
How can you quickly find the number of elements stored in a static array? Why is it difficult to store linked list in an array?
Write a program to find the reverse Fibonacci series starting from N.
What c++ is used for?
What is the use of turbo c++?
what you know about c++?
Why c++ is called oop?
What is oop in c++?
Define a constructor?
How much do c++ programmers make?
What is the sequence of destruction of local objects?