Inheritance: AbstractClass
Beispiel #1
0
        static void Main(string[] args)
        {
            #region 基本用法(对应Basic.cs)
            AbstractClass c;

            c = new ConcreteClassA();
            c.TemplateMethod();

            c = new ConcreteClassB();
            c.TemplateMethod();

            #endregion

            #region 具体实例(对应Example.cs)
            Console.WriteLine("学生甲抄的试卷:");
            TestPaper studentA = new TestPaperA();
            studentA.TestQuestion1();
            studentA.TestQuestion2();
            studentA.TestQuestion3();

            Console.WriteLine("学生乙抄的试卷:");
            TestPaper studentB = new TestPaperB();
            studentB.TestQuestion1();
            studentB.TestQuestion2();
            studentB.TestQuestion3();

            Console.Read();
            #endregion
        }
        static void Main(string[] args)
        {
            Console.WriteLine("學生甲抄的試卷 :");
            TestPaperA paperA = new TestPaperA();

            paperA.TestQuestion1();
            paperA.TestQuestion2();
            paperA.TestQuestion3();

            Console.WriteLine();

            Console.WriteLine("學生乙抄的試卷 :");
            TestPaperB paperB = new TestPaperB();

            paperB.TestQuestion1();
            paperB.TestQuestion2();
            paperB.TestQuestion3();

            Console.WriteLine("\n");

            AbstractClass abstractClass;

            abstractClass = new ConcreteClassA();
            abstractClass.TemplateMethod();

            abstractClass = new ConcreteClassB();
            abstractClass.TemplateMethod();

            Console.ReadLine();
        }
Beispiel #3
0
        static void Main(string[] args)
        {
            #region 基本用法(对应Basic.cs)
            AbstractClass c;

            c = new ConcreteClassA();
            c.TemplateMethod();

            c = new ConcreteClassB();
            c.TemplateMethod();

            #endregion

            #region 具体实例(对应Example.cs)
            Console.WriteLine("学生甲抄的试卷:");
            TestPaper studentA = new TestPaperA();
            studentA.TestQuestion1();
            studentA.TestQuestion2();
            studentA.TestQuestion3();

            Console.WriteLine("学生乙抄的试卷:");
            TestPaper studentB = new TestPaperB();
            studentB.TestQuestion1();
            studentB.TestQuestion2();
            studentB.TestQuestion3();

            Console.Read();
            #endregion
        }
Beispiel #4
0
        static void Main(string[] args)
        {
            AbstractClass abstractClassA = new ConcreteClassA();

            abstractClassA.TemplateMethod();

            AbstractClass abstractClassB = new ConcreteClassB();

            abstractClassB.TemplateMethod();
        }
Beispiel #5
0
        static void Main(string[] args)
        {
            AbstractClass abstrata_a = new ConcreteClassA();

            abstrata_a.TemplateMethod();

            AbstractClass abstrata_b = new ConcreteClassB();

            abstrata_b.TemplateMethod();
        }
        static void Main(string[] args)
        {
            AbstractClass abstractClass = new ConcreteClassA();
            abstractClass.Launch();

            abstractClass = new ConcreteClassB();
            abstractClass.Launch();

            Console.Read();
        }
Beispiel #7
0
        static void Main(string[] args)
        {
            AbstractClass aA = new ConcreteClassA();

            aA.TemplateMethod();
            AbstractClass aB = new ConcreteClassB();

            aB.TemplateMethod();
            Console.ReadKey();
        }
Beispiel #8
0
    static void Main()
    {
      AbstractClass a = new ConcreteClassA();
      a.TemplateMethod();
 
      AbstractClass b = new ConcreteClassB();
      b.TemplateMethod();
      
      Console.ReadKey();
    }
Beispiel #9
0
        /// <summary>
        /// Entry point into console application.
        /// </summary>
        static void Main()
        {
            AbstractClass aA = new ConcreteClassA();

            aA.TemplateMethod();

            AbstractClass aB = new ConcreteClassB();

            aB.TemplateMethod();
        }
Beispiel #10
0
        static void Main(string[] args)
        {
            AbstractClass a1 = new ConcreteClassA();
            AbstractClass b1 = new ConcreteClassB();

            a1.TemplateMethod();
            b1.TemplateMethod();

            Console.ReadKey();
        }
Beispiel #11
0
        static void Main(string[] args)
        {
            var c1 = new ConcreteClassA();

            c1.TemplateMethod();

            var c2 = new ConcreteClassB();

            c2.TemplateMethod();

            Console.ReadKey();
        }
Beispiel #12
0
        private static void Main()
        {
            var abstractClassA = new ConcreteClassA();

            abstractClassA.TemplateMethod();

            var abstractClassB = new ConcreteClassB();

            abstractClassB.TemplateMethod();

            Console.ReadKey();
        }
Beispiel #13
0
        static void Main()
        {
            AbstractClass aA = new ConcreteClassA();

            aA.TemplateMethod();

            AbstractClass aB = new ConcreteClassB();

            aB.TemplateMethod();

            // Wait for user
            Console.ReadKey();
        }
Beispiel #14
0
        private static void Main(string[] args)
        {
            // canonical
            Console.WriteLine("concrete class A");
            var a = new ConcreteClassA();

            a.TemplateMethod();

            Console.WriteLine("concrete class B");
            var b = new ConcreteClassB();

            b.TemplateMethod();

            // live
            Console.WriteLine();
            var dao = new Products("connection string");

            dao.Run();
        }
Beispiel #15
0
        static void Main(string[] args)
        {
            AbstractClass a = new ConcreteClassA();

            a.TemplateMethod();

            a = new ConcreteClassB();
            a.TemplateMethod();



            int[] intArray = new int[] { 5, 3, 12, 8, 10 };

            IntBubbleSorter intBubbleSorter = new IntBubbleSorter();

            intBubbleSorter.Sort(intArray);
            foreach (var item in intArray)
            {
                Console.Write(item + " ");
            }
            Console.WriteLine("");
            float[]           floatArray  = new float[] { 5.1f, 3.1f, 12.1f, 8.1f, 10.1f };
            FloatBubbleSorter floatSorter = new FloatBubbleSorter();

            floatSorter.Sort(floatArray);
            foreach (float item in floatArray)
            {
                Console.Write(item + " ");
            }


            string subClassStr      = ConfigurationManager.AppSettings["subClass"];
            var    intBubbleSorter2 = (IntBubbleSorter)Assembly.Load("TemplateMethod").CreateInstance(subClassStr);

            intBubbleSorter2.Sort(intArray);


            Console.Read();
        }