Ejemplo n.º 1
0
 static void Main(string[] args)
 {
     Console.WriteLine("***静的メソッドの実装例 その2 ***\n");
     NonStaticClass anObject = new NonStaticClass();
     anObject.NonStaticMethod();
     //anObject.StaticMethod(); //エラー CS0176  インスタンス参照でメンバー 'NonStaticClass.StaticMethod()' にアクセスできません。代わりに型名を使用してください
     NonStaticClass.StaticMethod();
     Console.ReadKey();
 }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            Console.WriteLine("***Exploring static methods.Example-2***\n");
            NonStaticClass anObject = new NonStaticClass();

            anObject.NonStaticMethod();//Ok
            //anObject.StaticMethod();//Error
            NonStaticClass.StaticMethod();
            Console.ReadKey();
        }