Why can't we create an instance of an abstract class?

前端 未结 7 2157
再見小時候
再見小時候 2021-01-04 13:29

I found in many places that :

  • An Abstract Class is a class which is supposed to be used as a base class.
  • An Abstract Class is a class which has atleas
7条回答
  •  清酒与你
    2021-01-04 13:41

    The reason an abstract class cannot be instantiated is: what do you do if you execute the pure virtual function? That would be a serious error, and it's better to catch that at compile-time than at runtime.

提交回复
热议问题