2013-03-05 12:18
⁄ 工业·编程
⁄ 共 927字
#include <iostream> #include <list> using namespace std;
// struct IResume { public: virtual ~IResume() { }
virtual void SetPersonalInfo() = 0; virtual void SetEducationInfo() = 0; virtual void SetWorkInfo() = 0;
void FillResume() { ...
设计模式阅读全文
2013-03-04 12:17
⁄ 工业·编程
⁄ 共 887字
#include <iostream> #include <list> using namespace std;
// struct IObserver { public: virtual ~IObserver() { }
virtual void Update() = 0; };
class CObserver : public IObserver { public: CObserver(string name) : m_name(name) { } virtual ~CObserver() { }
virtual...
设计模式阅读全文
2013-03-03 12:16
⁄ 工业·编程
⁄ 共 741字
#include <iostream> using namespace std;
// struct ITravelWay { public: virtual ~ITravelWay() { }
virtual void Travel() = 0; };
class CTrainWay : public ITravelWay { public: virtual ~CTrainWay() { }
virtual void Travel() { cout<<"Travel by train."<<endl; } };
class CA...
设计模式阅读全文
2013-03-02 12:15
⁄ 工业·编程
⁄ 共 829字
代理模式,对象适配器模式的区别:
适配器模式:适配者与被适配者接口不同,为了是用户使用同一的接口。
代理模式:代理者与被代理者接口相同,只是客户不能访问到被代理者。
#include <iostream> using namespace std;
// struct IImage { public: IImage(string name) : m_name(name) { } virtual ~IImage() { }
virtual void ...
设计模式阅读全文
2013-03-01 12:14
⁄ 工业·编程
⁄ 共 664字
#include <iostream> using namespace std;
// class CDeque { public: void push_front() { cout<<"CDeque push_front."<<endl; } void push_back() { cout<<"CDeque push_back."<<endl; } void pop_front() { cout<<"CDeque pop_front."<<endl; } ...
设计模式阅读全文
2013-02-28 12:13
⁄ 工业·编程
⁄ 共 728字
#include <iostream> using namespace std;
// class CDeque { public: void push_front() { cout<<"CDeque push_front"<<endl; } void push_back() { cout<<"CDeque push_back"<<endl; } void pop_front() { cout<<"CDeque pop_front"<<endl; } ...
设计模式阅读全文
2013-02-27 12:12
⁄ 工业·编程
⁄ 共 633字
#include <iostream> #include <string> using namespace std;
// class CScanner { public: void Scan() { cout<<"词法分析"<<endl; } };
class CParse { public: void Parse() { cout<<"语法分析"<<endl; } };
class CGenMidCode { public: void GenMidCode() { c...
设计模式阅读全文
2013-02-26 12:11
⁄ 工业·编程
⁄ 共 1250字
#include <iostream> #include <string> using namespace std;
// struct IPhone { public: IPhone() { } virtual ~IPhone() { }
virtual void ShowDecorate() = 0; };
class CApplePhone : public IPhone { public: CApplePhone(string name) : m_name(name) { } virtual ~CApp...
设计模式阅读全文
2013-02-25 12:10
⁄ 工业·编程
⁄ 共 1700字
#include <iostream> #include <string> #include <vector> using namespace std;
// struct ICompany { public: ICompany(string name) : m_name(name) { } virtual ~ICompany() { }
virtual void Add(ICompany *pCompany) = 0; virtual void Show(int nDepth) = 0;
protected: ...
设计模式阅读全文
2013-02-24 12:09
⁄ 工业·编程
⁄ 共 1096字
#include <iostream> using namespace std;
// struct IOS { public: virtual ~IOS() { }
virtual void InstallOS_Imp() = 0; };
class CWindowsOS : public IOS { public: virtual ~CWindowsOS() { }
virtual void InstallOS_Imp() { cout<<"Windows."<<endl; } };
class CLinuxOS : publ...
设计模式阅读全文