Why can't an object of abstract class be created?

前端 未结 16 968
误落风尘
误落风尘 2020-12-02 21:25

Here is a scenario in my mind and I have googled, Binged it a lot but got the answer like

\"Abstract class has not implemented method so, we cant create the object\

16条回答
  •  无人及你
    2020-12-02 21:34

    The reference studytonight :

    When we create a pure virtual function in Abstract class, we reserve a slot for a function in the VTABLE(studied in last topic), but doesn't put any address in that slot. Hence the VTABLE will be incomplete.

    As the VTABLE for Abstract class is incomplete, hence the compiler will not let the creation of object for such class and will display an errror message whenever you try to do so.

提交回复
热议问题