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


Please Help Members By Posting Answers For Below Questions

What are the methods in c#?

541


What is written in c#?

552


Are there functions in c#?

518


Any problem found in vs.et

596


What is var c#?

506






What Is The Smallest Unit Of Execution In .net?

536


what is the difference between a struct and a class in c#?

577


What is the purpose of constructor in c#?

459


in object oriented programming, how would you describe encapsulation?

571


Does c# support c type macros?

563


What is difference between code access and role based security?

520


what are the Disadvantages of vb

606


What is managed code?

552


Give some examples of commonly used i/o classes?

510


What is the base class for array types?

583