可以使用带有示例的c#在Abstract Class中创建构造函数 [英] it is possible to create Constructors in Abstract Class using c# with examples

查看:232
本文介绍了可以使用带有示例的c#在Abstract Class中创建构造函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可以使用带有示例的c#在Abstract Class中创建构造函数
请告诉答案.....

it is possible to create Constructors in Abstract Class using c# with examples
pls tell the answer .....

推荐答案

您可以在抽象类中创建构造函数-但它们不是继承的.在派生类中,您唯一的选择是将调用哪个基类构造函数.您不能声明抽象构造函数,因为无论类是抽象的还是可以实例化的,构造函数都不能被覆盖.

在抽象类中,您只需将构造函数声明为正常.
You can create constructors in an abstract class - but they are not inherited. Your only choice in the derived class is which of the base class constructors you will call. You cannot declare an abstract constructor, because constructors cannot be overridden, regardless of whether the class is abstract or can be instantiated.

In the abstract class, you just declare constructors as normal.


这篇关于可以使用带有示例的c#在Abstract Class中创建构造函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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