Does an abstract classes have a VTABLE?

前端 未结 3 1141
春和景丽
春和景丽 2020-12-10 13:58

Do we have virtual table for an abstract class?

3条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-10 14:45

    We have a virtual table for a class which has atleast one virtual function. that virtual function can also be pure. this means. an abstact class can have a vtable.

    in case of abstact classes the vtable entry will be NULL. when ever you try to instantiate a abstract class it will check in tha vtable and check for a NULL value is present or not. if NULL is present the compiler will throw an error.

提交回复
热议问题