静的メソッドでインスタンスメソッドを呼び出す自作自販
1789 ワード
public class SomeClass
{
private string myfield = null;
public static SomeClass instance = new SomeClass();
public instranceMethod() {};
public static staticMethod() {};
}
public class AnotherClass
{
public static Main()
{
// , ,
SomeClass someClass = new SomeClass();
someClass.instanceMethod();
// , ,
SomeClass.instance.instanceMethod();
// ,
SomeClass.staticMethod();
}
}