// Widget.h
#ifndef _WIDGET_H
#define _WIDGET_H
class Widget {
public:
Widget();
virtual void draw() = 0;
};
#endif
說明:
// Decorator.h
#ifndef _DECORATOR_H
#define _DECORATOR_H
#include "Widget.h"
class Decorator : public Widget {
public:
Decorator(const Widget * myWidget);
void draw();
private:
Widget * myWidget;
};
#endif