开发者

C# Calling Base Class Constructor

public CArm(Vector3 at, string name) : base(name)
{

}

Is there any other way to call base parent constructor within the brackets instead of doing : base(name)?

I'm not sure if this was a开发者_高级运维nother language but I recall something like super(); inside of the constructor to call the base class.

Thanks.


No, you cannot call base constructors inside constructor bodies in C#. You're probably thinking of Java's syntax.

You can emulate the desired behavior by calling a method instead. Just make sure to be very careful about calling virtual methods!


no, you can't . super keyword is used in java for calling superclass methods and objects.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜