设计模式04 非装饰者模式 bylp

设计模式04 非装饰者模式

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace 设计模式03
{
    class Program
    {
        static void Main(string[] args)
        {
            Person lp_a = new Person("刘鹏");
            lp_a.Show();
            lp_a.WearShirts();
            lp_a.WearTShirts();
            lp_a.WearSneakers();

            Console.ReadLine();
        }
    }
    class Person
    {
        private string name;

        public Person(string name)
        {
            this.name = name;
        }

        public void WearShirts()
        {
            Console.Write("大T恤");
        }

        public void WearTShirts()
        {
            Console.Write("垮裤");
        }

        public void WearSneakers()
        {
            Console.Write("破球鞋");
        }

        public void WearSuit()
        {
            Console.Write("西装");
        }

        public void WearTie()
        {
            Console.Write("领带");
        }

        public void WearLeatherShoes()
        {
            Console.Write("皮鞋");
        }

        public void Show()
        {
            Console.Write("装扮的{0}", name);
        }
    }
}

猜你喜欢

转载自blog.csdn.net/lpZhouYi/article/details/80071192