Why we can't create the object of abstract class ?
Answer Posted / abhishek ajmera
When we declare a pure virtual function like this:-
Virtual PureVirtualFunction()=0;
This indicates compiler to reserve a slot for Function in VTABLE but don’t put an address in that particular slot. If only one function in a class is declared as pure virtual, the VTABLE is incomplete.
If the VTABLE for a class is incomplete, compiler cannot safely create an object of a pure abstract class, so you get an error message from the compiler if you try to make an object of a pure abstract class. Thus, the compiler ensures the purity of the abstract class, and you don’t have to worry about misusing it.
| Is This Answer Correct ? | 10 Yes | 1 No |
Post New Answer View All Answers
What is parameter c#?
can you create a function in c# which can accept varying number of arguments
What is public void in c#?
Explain the difference between arraylist and array and in c#?
What does mean before a string in c#?
Any problem found in vs.et
Why do you need boxing in c#?
What is lastindexof c#?
Which namespace is required to implement trace ?
Is dictionary a collection?
Explain the differences between static, void and public in c#?
Why we use get and set property in c#?
What is readline library?
Do while loops yes or no c#?
What are the collection types can be used in c#?