为了账号安全,请及时绑定邮箱和手机立即绑定

c#中this的用法?如下所示!

c#中this的用法?如下所示!

Go C C#
GCT1015 2021-01-20 14:15:23
using System;namespace CallConstructor{public class Car{int petalCount = 0;String s = "null";Car(int petals){petalCount = petals;Console.WriteLine("Constructor w/int arg only,petalCount = " + petalCount);}Car(String s, int petals): this(petals){this.s = s;Console.WriteLine("String & int args");}Car(): this("hi", 47){Console.WriteLine("default constructor");}public static void Main(){Car x = new Car();Console.Read();}}}能帮我解释一下这段代码中几个this的意思吗?
查看完整描述

2 回答

  • 2 回答
  • 0 关注
  • 335 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号