Exemplo n.º 1
0
        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();
        }
Exemplo n.º 2
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
        }
Exemplo n.º 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
        }
Exemplo n.º 4
0
        static void Main(string[] args)
        {
            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();
        }
Exemplo n.º 5
0
        static void Main(string[] args)
        {
            Console.WriteLine("学生A抄的试卷");
            TestPaperA a = new TestPaperA();

            a.TestQuestion1();
            a.TestQuestion2();
            a.TestQuestion3();
            a.TestQuestion4();

            Console.WriteLine("学生A抄的试卷");
            TestPaperB b = new TestPaperB();

            b.TestQuestion1();
            b.TestQuestion2();
            b.TestQuestion3();
            b.TestQuestion4();

            Console.ReadKey();
        }