Пример #1
0
        static void Main(string[] args)
        {
            Person xc = new Person("测试用户");

            Console.WriteLine("\n 第一种装扮:");

            Sneakers   pqx = new Sneakers();
            BigTrouser kk  = new BigTrouser();
            TShirt     dtx = new TShirt();

            pqx.Decorate(xc);
            kk.Decorate(pqx);
            dtx.Decorate(kk);

            dtx.Show();

            Console.Read();
        }
Пример #2
0
        static void Main(string[] args)
        {
            Person xc = new Person("小菜");

            Console.WriteLine("\n第一种装扮: ");

            BigTrouser bt  = new BigTrouser();
            TShirts    dtx = new TShirts();

            bt.Decorate(xc);
            dtx.Decorate(bt);
            dtx.show();

            Console.WriteLine("\n第二种装扮: ");

            TShirts    dtx2 = new TShirts();
            BigTrouser bt2  = new BigTrouser();

            dtx2.Decorate(xc);
            bt2.Decorate(dtx2);
            bt2.show();

            Console.Read();
        }