我们可以为抽象类的构造函数显式指定返回类型吗? [英] Can we explicitly specify return type for constructor of abstract class?

查看:107
本文介绍了我们可以为抽象类的构造函数显式指定返回类型吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好朋友,

据我所知,您无法创建抽象类的对象.

我想抽象类的构造函数不能有返回类型.

我还想问一下,普通类的构造函数可以有返回类型吗?

有什么好礼吗?

在此先感谢

Hello friends,

As I know you cant create an object of abstract class.

I guess there cant be return type for constructor of abstract class.

I also wanted to ask, do constructor of normal class can have return type?

Any sugession?

Thanks in advance

推荐答案

否,构造函数不能有任何返回类型.
但是您可以在构造函数中指定一个out参数,该参数将返回一个值.
No, constructors cannot have any return type.
But you can specify an out parameter inside constructor which will return a value.


这篇关于我们可以为抽象类的构造函数显式指定返回类型吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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