使用此代码:
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("saturnisko: {0}", UkladSloneczny.saturn.mass);
}
}
public class UkladSloneczny
{
private Saturn sat;
public UkladSloneczny(Saturn sat)
{
this.sat = sat;
}
public Saturn saturn
{
get { return this.sat; }
}
}
public class Saturn
{
private int masa;
public Saturn() { masa = 0; }
public int mass
{
get { return this.masa; }
}
}
为什么我收到这样的错误:
Error 1 An object reference is required for the non-static field, method, or property 'ConsoleApplication1.UkladSloneczny.saturn.get'
?