标签:style blog io ar color os sp on div
#include <iostream> using namespace std; class Product { public: virtual ~Product() {} virtual void Action()=0; }; class ConcreteProduct : public Product { public: ConcreteProduct() {} ~ConcreteProduct() {} void Action() { cout<<"ConcreteProduct::Action"<<endl; } }; class SaleProxy : public Product { public: SaleProxy() { m_pProduct = new ConcreteProduct; } ~SaleProxy() { delete m_pProduct; m_pProduct = NULL; } void Action() { cout<<"SaleProxy::"; m_pProduct->Action(); } private: Product* m_pProduct; }; int main(int argc, char *argv[]) { ConcreteProduct realProduct; realProduct.Action(); SaleProxy proxy; proxy.Action(); return 0; }
标签:style blog io ar color os sp on div
原文地址:http://www.cnblogs.com/stanley198610281217/p/4156840.html