#ifndef EXCEL_DECORATOR
#define EXCEL_DECORATOR
class component_abstable
{
public:
virtual void puttable() = 0;
};
class ConcreteComponent_abstable:public component_abstable
{
public:
virtual void puttable()
{
printf("姓名:\n");
printf("性别:\n");
printf("学历:\n");
printf("年龄:\n");
}
};
class Decorator_abstable:public component_abstable
{
public:
Decorator_abstable(component_abstable * concrete_abstable) :mp_component_abstable(concrete_abstable)
{
printf("Decorator_abstable 构造函数\n");
}
virtual void puttable()
{
mp_component_abstable->puttable();
}
private:
component_abstable * mp_component_abstable;
};
class EnglishDec:public Decorator_abstable
{
public:
EnglishDec(component_abstable *mptable) :Decorator_abstable(mptable)
{
}
virtual void puttable()
{
printf("英语等级\n");
Decorator_abstable::puttable();
}
};
#endif
int main()
{
ConcreteComponent_abstable pro1;
printf("###原始表格:\n");
pro1.puttable();
printf("###新表格:\n");
EnglishDec englishdec(&pro1);
englishdec.puttable();
printf("=====================================================\n");
system("pause");
return 1;
}