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

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的意思吗?

GCT1015
浏览 326回答 2
2回答
打开App,查看更多内容
随时随地看视频慕课网APP