我将项目的基类更改为 abstract
,现在我收到以下错误:
Cannot create an instance of the abstract class or interface
我是否收到错误,因为不允许命名 abstract
类的新实例?
newPlane = new Airplane_Abstract(name, position);
最佳答案
您不能创建抽象类的实例。将其视为可能包含一些实现逻辑的接口(interface)。如果你调用一个没有定义的抽象实例方法,你会期望发生什么?
关于c# - "Cannot create an instance of the abstract class or interface"C#错误信息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4949242/