Exemplo n.º 1
0
        public static void Main(string[] args)
        {
            Console.WriteLine("========原型模式-測試=======");
            Resume resume = new Resume("傑克", "見習道士", 1);

            resume.setExperience("2011/01/01", "仙靈島");

            //履歷表2跟1有很多相似處,因此直接複製履歷表1修改
            Resume resume2 = (Resume)resume.Clone();

            resume2.Level = 5;
            resume2.setExperience("2012/3/31", "隱龍窟");

            //履歷表3跟1有許多相似處,因此直接複製履歷表1修改
            Resume resume3 = (Resume)resume2.Clone();

            resume3.Profession = "殭屍道長";
            resume3.setExperience("2012/11/31", "赤鬼王血池");

            Console.WriteLine("第一份履歷");
            resume.display();
            Console.WriteLine("第二份履歷(複製上一份修改)");
            resume2.display();
            Console.WriteLine("第三份履歷(複製上一份修改)");
            resume3.display();
        }