"无法创建抽象类或接口&QUOT的实例; C# [英] "Cannot create an instance of the abstract class or interface" C#

查看:1134
本文介绍了"无法创建抽象类或接口&QUOT的实例; C#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我改变了我的基类摘要(当然因此而得名)的一个项目,现在我得到这个错误。我的猜测是,你不能命名一个抽象类的新实例



  newPlane =新Airplane_Abstract(姓名,职务)?; 


解决方案

您不能创建一个抽象类的实例。把它看成是可能含有一些实现逻辑和界面。你会想到发生,如果你叫一个抽象的实例方法没有定义?


I changed my base class to Abstract (hence the name of course) for a project and now i'm getting this error. my guess is you can't name a new instance of an Abstract class?

newPlane = new Airplane_Abstract(name, position);

解决方案

You can't create an instance of an abstract class. Think of it as an interface that may contain some implementation logic as well. What would you expect to happen if you called an abstract instance method with no definition?

这篇关于"无法创建抽象类或接口&QUOT的实例; C#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆