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

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

    It's intended to be used as a base class.

    http://msdn.microsoft.com/en-us/library/sf985hc5(VS.71).aspx

    The abstract modifier can be used with classes, methods, properties, indexers, and events.

    Use the abstract modifier in a class declaration to indicate that a class is intended only to be a base class of other classes.

    Abstract classes have the following features:

    • An abstract class cannot be instantiated.
    • An abstract class may contain abstract methods and accessors.
    • It is not possible to modify an abstract class with the sealed modifier, which means that the class cannot be inherited.
    • A non-abstract class derived from an abstract class must include actual implementations of all inherited abstract methods and accessors.

提交回复
热议问题