why the size of an empty class is 1
Answers were Sorted based on User's Feedback
Answer / hitesh sojitra
When you calculate the size of a empty class that time you can c it takes 1 byte.which is the size of a char which a compiler takes for storing the address of a empty class.
The size of an empty class would depend on what is the range specified for the compiler for char. It takes that much space to store the address of a class.
| Is This Answer Correct ? | 13 Yes | 1 No |
Answer / abhishek
its because an empty class makes an entry to symbol table (code segment)
which requires a symoblic mapping of 1 byte
| Is This Answer Correct ? | 9 Yes | 4 No |
Answer / kamna
it is becuse each oject must have a different address.
| Is This Answer Correct ? | 10 Yes | 5 No |
Answer / surender a
Because the fundamental size is a char [viz 1 byte by
default on any 32 bit or 64 bit machine].
| Is This Answer Correct ? | 5 Yes | 7 No |
what is the order of initialization for data?
10 Answers Amazon, TCS, Wipro,
What is ios class in c++?
Reads in the size of a square from the screen; 2. Prints a hollow square of that size out of “-“, “|” and blanks on screen; 3. Prints the same hollow square onto a text file. Your program should work for squares of all side sizes between 1 and 20. --- │ │ │ │ │ │ ---
What is c++ in english?
How do you establish an is-a relationship?
Is it possible to pass an object of the same class in place of object reference to the copy constructor?
Can you think of a situation where your program would crash without reaching the breakball, which you set at the beginning of main()?
What is the extraction operator and what does it do?
which is best institue to learn C/C++ IN AMEERPET OR MAITHRIVANAM OR SR NAGAR, PLEASE HELP. THANKS IN ADVANCE
Does c++ have finally?
When copy constructor can be used?
Can a built-in function be recursive?