このコードで:
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'
?