标签:des style blog color sp div on log bs
void Main() { Component c1 = new Component(); Decorator da = new DecoratorA(); da.Decorate(c1); Decorator db = new DecoratorB(); db.Decorate(da); db.Show(); } class Component{ public virtual void Show(){} } abstract class Decorator:Component { protected Component component; public void Decorate(Component c){component=c;} } class DecoratorA:Decorator{ public override void Show(){ component.Show(); } } class DecoratorB:Decorator{ public override void Show(){ component.Show(); } }
DesignPattern_Structural_Decorator
标签:des style blog color sp div on log bs
原文地址:http://www.cnblogs.com/rammderek/p/4102880.html