Beispiel #1
0
        private static void NewMethod1()
        {
            Person pr = new Person("Leng");

            Console.WriteLine("first look");

            Finery tShirts = new TShirts();

            tShirts.Show();
            Finery bigTrouser = new BigTrouser();

            bigTrouser.Show();
            Finery sneakers = new Sneakers();

            sneakers.Show();
            pr.Show();

            Console.WriteLine("\nsecond look");
            Finery suit = new Suit();

            suit.Show();
            Finery tie = new Tie();

            tie.Show();
            Finery leatherShoes = new LeatherShoes();

            leatherShoes.Show();
            pr.Show();

            Console.Read();
        }
Beispiel #2
0
        public static void Main(string[] args)
        {
            var person = new Person("Bryan");

            Console.WriteLine("第一種裝扮");

            Finery tShirts    = new TShirts();
            Finery bigTrouser = new BigTourser();
            Finery sneakers   = new Sneakers();

            tShirts.Decorate(person);
            bigTrouser.Decorate(tShirts);
            sneakers.Decorate(bigTrouser);
            sneakers.Show();

            Console.WriteLine("第二種裝扮");
            Finery suit         = new Suit();
            Finery tie          = new Tie();
            Finery leatherShoes = new LeatherShoes();

            suit.Decorate(person);
            tie.Decorate(suit);
            leatherShoes.Decorate(tie);
            leatherShoes.Show();

            Console.Read();
        }