ConcreteDecoratorB::operation PHP Method

operation() public method

public operation ( )
    public function operation()
    {
        parent::operation();
        $this->addedOperationB();
    }

Usage Example

Example #1
0
File: 0.php Project: ruyicoder/php
{
    private $addedState;
    //本类都有的,以区别于ConcreteDecoratorB
    public function operation()
    {
        parent::operation();
        $this->addedState = 'New state';
        var_dump('具体装饰对象A的操作');
    }
}
/*
 * 具体装饰类A
 */
class ConcreteDecoratorB extends Decorator
{
    public function operation()
    {
        parent::operation();
        $this->Addbehavior();
        var_dump('具体装饰对象B的操作');
    }
    public function Addbehavior()
    {
    }
}
//客户端代码
$c = new ConcreteComponent();
$d1 = new ConcreteDecoratorA($c);
$d1 = new ConcreteDecoratorB($d1);
$d1->operation();
All Usage Examples Of ConcreteDecoratorB::operation