static void Main(string[] args)
        {
            IList<Person> persons = new List<Person>();

            Person man1 = new Man();
            man1.Action = "成功";
            persons.Add(man1);
            Person woman1 = new Woman();
            woman1.Action = "成功";
            persons.Add(woman1);

            Person man2 = new Man();
            man2.Action = "失敗";
            persons.Add(man2);
            Person woman2 = new Woman();
            woman2.Action = "失敗";
            persons.Add(woman2);

            Person man3 = new Man();
            man3.Action = "戀愛";
            persons.Add(man3);
            Person woman3 = new Woman();
            woman3.Action = "戀愛";
            persons.Add(woman3);

            foreach (Person item in persons)
            {
                item.GetConclusion();
            }

            Console.Read();
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            IList <Person> persons = new List <Person>();

            Person man1 = new Man();

            man1.Action = "成功";
            persons.Add(man1);
            Person woman1 = new Woman();

            woman1.Action = "成功";
            persons.Add(woman1);

            Person man2 = new Man();

            man2.Action = "失敗";
            persons.Add(man2);
            Person woman2 = new Woman();

            woman2.Action = "失敗";
            persons.Add(woman2);

            Person man3 = new Man();

            man3.Action = "戀愛";
            persons.Add(man3);
            Person woman3 = new Woman();

            woman3.Action = "戀愛";
            persons.Add(woman3);

            foreach (Person item in persons)
            {
                item.GetConclusion();
            }

            Console.Read();
        }
 public override void GetWomanConclusion(Woman concreteElementB)
 {
     Console.WriteLine("{0}{1}時,欣慰曰:愛情長跑路漫漫,婚姻保險保平安。", concreteElementB.GetType().Name, this.GetType().Name);
 }
 public override void GetWomanConclusion(Woman concreteElementB)
 {
     Console.WriteLine("{0}{1}時,眼淚汪汪,誰也勸不了。", concreteElementB.GetType().Name, this.GetType().Name);
 }
 public override void GetWomanConclusion(Woman concreteElementB)
 {
     Console.WriteLine("{0}{1}時,背後大多有一個不成功的男人。", concreteElementB.GetType().Name, this.GetType().Name);
 }
 //得到女人結論或反應
 public abstract void GetWomanConclusion(Woman concreteElementB);
Beispiel #7
0
 public override void GetWomanConclusion(Woman concreteElementB)
 {
     Console.WriteLine("{0}{1}時,欣慰曰:愛情長跑路漫漫,婚姻保險保平安。", concreteElementB.GetType().Name, this.GetType().Name);
 }
Beispiel #8
0
 public override void GetWomanConclusion(Woman concreteElementB)
 {
     Console.WriteLine("{0}{1}時,遇事懂也裝作不懂", concreteElementB.GetType().Name, this.GetType().Name);
 }
Beispiel #9
0
 //得到女人結論或反應
 public abstract void GetWomanConclusion(Woman concreteElementB);