- 博客(9)
- 资源 (5)
- 收藏
- 关注
原创 装饰者模式-c++实现
// decoratorpattern.cpp : 定义控制台应用程序的入口点。//#include "stdafx.h"#include #include #include using namespace std;//抽象类Tankclass Tank{public: virtual void shot() = 0; virtual void run() = 0;
2016-05-26 23:14:59 1209
转载 FireBreath -- Summary--方法 属性 Attributes 事件和js的交互等
【方法】JSAPI 对javascript暴露了四种基本类型的接口(Methods, Properties, Attributes, and Events),每一种接口都必须在JSAPI对象的构造函数中注册(Attributes和Events除外)。Attributes可以在任何一个除了析构函数的函数中注册(registerAttribute(const std::string&
2016-05-19 13:45:48 2278
原创 适配器模型-c++实现
目前写的最简单的一个设计模式代码// adapterpattern.cpp : 定义控制台应用程序的入口点。//#include "stdafx.h"#include using namespace std;//接口class Target{public: virtual void Request(){}};//源classclass Adaptee{p
2016-05-18 23:07:51 1404
原创 单例模式-c++实现
结合前辈们的博客,写下自己写的单例模式实现,暂时没有考虑多线程情况下#include using namespace std;class Singleton{public: static Singleton *GetInstance() { return m_Instance; } int GetTest() { return m_Test; }pr
2016-05-17 22:33:46 1365
原创 原型模式-c++实现
// CplusplusPrototype.cpp : Defines the entry point for the console application.//#include "stdafx.h"#include#include#include#includeusing namespace std;//父类 class Resume{protected: char
2016-05-17 00:15:18 1500
原创 建造者模式 - C++实现
// buliderpattern.cpp : 定义控制台应用程序的入口点。//#include "stdafx.h"#include #include #include using namespace std;class Food{private: vector m_vecFoodPrice; vector m_vecFoodName;public:
2016-05-11 23:52:45 1462
原创 抽象工厂模式- c++实现
懒得写说明啊// abstructfactory.cpp : 定义控制台应用程序的入口点。//#include "stdafx.h"#include using namespace std;class buttom{public: virtual void doButtom() {};};class text{};class UnixButtom:publ
2016-05-09 23:33:52 1819
原创 工厂模式-c++实现
// factorypattern.cpp : 定义控制台应用程序的入口点。//#include "stdafx.h"#include using namespace std;class IProduct{public: IProduct() {}; virtual ~IProduct() {};};class IPhone :public IProduct{
2016-05-04 22:46:57 1401
原创 状态模式-c++实现
// statepattern.cpp : 定义控制台应用程序的入口点。//#include "stdafx.h"#include using namespace std;class Person;class MainState{ public: virtual void attack() = 0; virtual void stand() = 0;};c
2016-05-03 23:30:55 1487
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人