コード例 #1
0
        static void Main(string[] args)
        {
            Console.WriteLine("甲抄的试卷:");
            TestPaper testPaperA = new TestPaperA();

            testPaperA.TemplateMethod();

            Console.WriteLine("乙抄的试卷:");
            TestPaper testPaperB = new TestPaperB();

            testPaperB.TemplateMethod();

            Console.ReadKey();
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: L1xl/DesignPatterns
        static void Main(string[] args)
        {
            TestPaper paperA = new TestPaperA();

            paperA.Question1();
            paperA.Question2();

            TestPaper paperB = new TestPaperB();

            paperB.Question1();
            paperB.Question2();

            Console.ReadLine();
        }
コード例 #3
0
        static void Main(string[] args)
        {
            TestPaper s1 = new TestPaperA();
            TestPaper s2 = new TestPaperB();

            s1.TestQuestion1();
            s1.TestQuestion2();
            s1.TestQuestion3();

            s2.TestQuestion1();
            s2.TestQuestion2();
            s2.TestQuestion3();

            Console.ReadKey();
        }
コード例 #4
0
        public static void Main(string[] args)
        {
            #region Prototype

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

            Console.WriteLine();

            #endregion Prototype

            var paper1 = new TestPaperA();
            paper1.TestResult();

            var pager2 = new TestPaperB();
            pager2.TestResult();

            Console.ReadLine();
        }