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

前端 未结 7 2290
再見小時候
再見小時候 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:46

    That's the whole point of an abstract class: that some details must be provided by the implementor.

    Think about it: what would be the point of marking a class as abstract if you could instantiate it directly? Then it would be no different than any other class.

提交回复
热议问题