?? decorator.cpp
字號(hào):
#include "Decorator.h"
#include <iostream>
Component::Component()
{
}
Component::~Component()
{
}
void Component::Operation()
{
}
ConcreteComponent::ConcreteComponent()
{
}
ConcreteComponent::~ConcreteComponent()
{
}
void ConcreteComponent::Operation()
{
std::cout<<"ConcreteComponent operation..."<<std::endl;
}
Decorator::Decorator(Component* com)
{
this->_com = com;
}
Decorator::~Decorator()
{
delete _com;
}
void Decorator::Operation()
{
}
ConcreteDecorator::ConcreteDecorator(Component*com):Decorator(com)
{
}
ConcreteDecorator::~ConcreteDecorator()
{
}
void ConcreteDecorator::AddedBehavior()
{
std::cout<<"ConcreteDecorator::AddedBehacior...."<<std::endl;
}
void ConcreteDecorator::Operation()
{
_com->Operation();
this->AddedBehavior();
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -