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

前端 未结 16 928
误落风尘
误落风尘 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:47

    An abstract type is defined largely as one that can't be created. You can create subtypes of it, but not of that type itself. The CLI will not let you do this.

    An abstract class has a protected constructor (by default) allowing derived types to initialize it.

    For example, the base-type Stream is abstract. Without a derived type where would the data go? What would happen when you call an abstract method? There would be no actual implementation of the method to invoke.

提交回复
热议问题