我最近开始学习C#.我刚刚了解了属性,并决定制作一个简单的程序,以便更好地理解它们.这是我写的代码:
class Dog
{
private int weight;
private string colour;
public string colour { get; set; }
public Dog(int theWeight, string theColour)
{
weight = theWeight;
colour = theColour;
}
}
Run Code Online (Sandbox Code Playgroud)
我得到一个模棱两可的错误.据我所知,这不应该发生.