コード例 #1
0
        public static void Main(string[] strings)
        {
            // you can't create a AbstractBaseClass object because it's
            // abstract - duh. C# generates a compile time error if you
            // uncomment the following line

            // AbstractBaseClass ba = new AbstractBaseClass();

            // now repeat the experiment with Subclass1
            Console.WriteLine("\nCreating a SubClass1 object");
            SubClass1 sc1 = new SubClass1();

            Test(sc1);

            // and finally a Subclass2 object

            Console.WriteLine("\nCreating a SubClass2 object");
            SubClass2 sc2 = new SubClass2();

            Test(sc2);

            // wait for user to acknowledge
            Console.WriteLine("Press Enter to terminate... ");
            Console.Read();
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: sempf/CSharp2012
 public static void Main(string[] strings)
 {
     // You can't create an AbstractBaseClass object because it's
     // abstract -- duh. C# generates a compile-time error if you
     // uncomment the following line.
     // AbstractBaseClass ba = new AbstractBaseClass();
     // Now repeat the experiment with Subclass1.
     Console.WriteLine("\ncreating a SubClass1 object");
     SubClass1 sc1 = new SubClass1();
     Test(sc1);
     // And, finally, a Subclass2 object
     Console.WriteLine("\ncreating a SubClass2 object");
     SubClass2 sc2 = new SubClass2();
     Test(sc2);
     // Wait for user to acknowledge.
     Console.WriteLine("Press Enter to terminate... ");
     Console.Read();
 }
コード例 #3
0
        static void Main(string[] args)
        {
            // You can't create an AbstractBaseClass object because it's
            // abstract. C# generates a compile-time error if you
            // uncomment the following line.
            // AbstractBaseClass ba = new AbstractBaseClass();

            // Now repeat the experiment with Subclass1.
            Console.WriteLine("\ncreating a SubClass1 object");
            SubClass1 sc1 = new SubClass1();

            Test(sc1);

            // And, finally, a Subclass2 object
            Console.WriteLine("\ncreating a SubClass2 object");
            SubClass2 sc2 = new SubClass2();

            Test(sc2);

            // Wait for user to acknowledge.
            Console.WriteLine("Press Enter to terminate... ");
            Console.Read();
        }