what is the size of an empty class
Answers were Sorted based on User's Feedback
Answer / som shekhar
1 byte.
Reason being when compiler sees an empty class then then it
assigns a 1 byte memory, since the compiler sees the
declaration of the class so he needs to assign some space in
the memory, and hence assign 1 byte memory to hold the
address of the class.
| Is This Answer Correct ? | 4 Yes | 1 No |
Answer / asdf
According to the standard C++03, all classes "shall have
nonzero size."
1 byte is the most common implementation but it is left up
to the vendor.
| Is This Answer Correct ? | 2 Yes | 0 No |
Answer / ankit sharma
size of empty class is 1 byte.
if object does not point to any resource.
it shows object is null but object also get some space in
memory by default either it is empty or not.
| Is This Answer Correct ? | 0 Yes | 0 No |
Answer / ansari razi
1 Byte,
when compiling the program compiler allocates 1 byte memory.
| Is This Answer Correct ? | 0 Yes | 0 No |
Answer / kaush
1 byte for empty class before assigning the value
| Is This Answer Correct ? | 0 Yes | 1 No |
What is function overloading and operator overloading?
What is multilevel inheritance in oop?
What is abstraction in oop with example?
can you give the dynamic polymorphism types?
What is the difference between static polymorphism and dynamic polymorphism?
What is Dynamic Polymorphism?
Can we override main method?
What is the use of unnamed namespaces in OOPS? The only advantage I know is that they dont need the scope resolution operator while accessing them. I want to know some other advantages of unnamed namespaces...
what is the abstract class,interface ,its difference with a programatic eg.? hi,recently i went for an interview they ask me what is abstract class ,interface and its difference I said abstract class contain abstact method ,abstract method is a method with no body.Abstract class cannot be instantiated.Abstract class is a base class it required derived class for the implementation of method. Interface is a syntactical contract that all derived class should follow it define properties ,method,events which are known as member of interface. Then They asked me what is the difference between them. I said abstract class interface 1.abstact class can implement method 1.interface cant 2.abstact class can contain constructor, 2.interface cant destructor 3.abstract class cannot support multiple 3.interface support inheritance etc Then they said some different answer I said dont no. Then they ask me when i should make abstract class for an project and when i should make interface. I said if suppose there is two class which must be having method with different logic then we sholud make abstract class. and if suppose we have two class having method .with different logic then we can make interface . Am i correct with my explaination.if not correct me .please provide me that when should we create abstract class and interface and what is difference .please help me
How can we use the preprocessor #if and #elseif.
What is encapsulation example?
Please tell me the oops concept with detailed answer