设计模式之 装饰模式

 

class Phone
{
public:
    virtual ~Phone(void){}
    virtual void show(void) = 0;
};

class iPhone: public Phone
{
public:
    iPhone(void);
    ~iPhone(void);
public:
    virtual void show(void);
};

class Decorator: public Phone
{
public:
    Decorator(Phone *phone);
    ~Decorator(void);
public:
    virtual void show(void);
protected:
    void addDecorator(void);
protected:
    Phone *phone_;
};

 

posted on 2015-07-30 17:59  霏霏暮雨  阅读(144)  评论(0编辑  收藏  举报

导航