void Start( ) { // Create ConcreteComponent and two Decorators ConcreteComponent c = new ConcreteComponent(); ConcreteDecoratorA d1 = new ConcreteDecoratorA(); ConcreteDecoratorB d2 = new ConcreteDecoratorB(); // Link decorators d1.SetComponent(c); d2.SetComponent(d1); d2.Operation(); }
void Start() { // Create ConcreteComponent and two Decorators ConcreteComponent component = new ConcreteComponent(); ConcreteDecoratorA decoratorA = new ConcreteDecoratorA(); ConcreteDecoratorB decoratorB = new ConcreteDecoratorB(); // Link decorators decoratorA.SetComponent(component); decoratorB.SetComponent(component); decoratorB.Operation(); }