自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(14)
  • 收藏
  • 关注

原创 proxy 模式示例

#include "Publicinc.hpp" class  Image { public:     virtual   ~Image()     {     }     virtual   void  Display() = 0; }; class  RealImage : public Image { public:     RealImage(const

2018-01-30 18:07:31 222

原创 observer 简单实例

#include "Publicinc.hpp" class  Observer { public:     virtual  ~Observer() { }     virtual  void  Update(int n) = 0; }; class  Subject {     typedef  std::vector  ObserverList;     type

2018-01-30 16:04:59 373

原创 可撤销的command pattern

#include "Publicinc.hpp" // Receiver class  Receiver { public:     string GetContent() const { return m_content; }     void   SetContent(const string& content) { m_content = content; }     void

2018-01-30 11:42:16 235

原创 visit pattern

#include "Publicinc.hpp" enum Gender {     Man = 0,     Woman = 1, }; class  CStudent; class  CTeacher; class  CVisitor { public:      virtual ~CVisitor() {}      virtual  void  visi

2018-01-29 15:18:02 244

原创 function 的简单实现

template  class  Invoker_Base { public:     virtual  R  operator()(Arg arg) = 0; }; template  class  Function_Ptr_Invoker :         public  Invoker_Base { private:     typedef  R (*FUNC

2018-01-26 17:27:16 536

原创 command 模式示例

// receiver class  Tape_Recorder { public:     void  Play()     {         printf("since my baby left me: \n");     }     void  Stop()     {         printf("ok. taking a break.\n");     }

2018-01-26 12:19:34 243

原创 常用排序算法的效率

int  Partition(int* data, int low, int high) {     int  key = data[low];     while  (low         while (low             if (key                 --high;             }             else {    

2018-01-25 11:24:30 297

原创 工厂模式和单例模式

#include #include using  namespace std; class  AbstractProductA { public:     virtual   ~AbstractProductA() {}     virtual   void  Operation() = 0; }; class  AbstractProductB { public:

2018-01-09 14:32:11 237

原创 设计模式之二: 策略模式

设计模式中的策略模式的学习

2017-07-01 16:40:42 222

原创 设计模式之一: 简单工厂模式

在读大话模式, 进行笔记,简单工厂模式,C++代码 引入这个模式之前, 首先是面向对象的三大特性, 封装,继承,和多态; 首先看有一个 计算器的功能: 如果按照 过程化写的代码,就是数据输入和业务逻辑是合在一起的; 所以用到了c++的封装的特性,将计算的业务封装成了一个类: class Operation  { public:  static double GetResul

2017-06-28 00:06:47 247

原创 继承,实现,关联,聚合,组合,依赖几种关系的介绍

继承: generalization 继承是一种泛化的关系,是子类和父类之间的纵向关系; 例如: 水果(一般化), 苹果,香蕉,橘子,榴莲(相对具体化); 在逻辑上,子类是父类的一种,是“is-a”的关系; 通常逻辑上具有上述关系("is-a")的类,就可以继承; 子类继承父类,则子类拥有了父类的所有方法和属性; UML类图: 实现:realization 实现是类和接口之

2017-06-26 17:03:07 837

原创 __cplusplus 使用的一种场合

#ifdef __cplusplus extern "C" { #endif void func(); #ifdef __cplusplus } #endif 1, 这种写法通常用于C和C++混合编程的时候; 2,C编译器和C++编译器都回用到这个头文件,当C++编译的时候,由于引入了    extern "C", 将会抑制对函数名和变量名的名称重整; 3,所以对于给函数

2017-06-26 16:59:39 1918

原创 线程同步问题小记

// demo.cpp : 定义控制台应用程序的入口点。 // #include #include #include #include #include #include #include #include using namespace std; CRITICAL_SECTION _critical; static DWORD WINAPI

2017-06-12 14:33:00 317

原创 C++ Lambda表达式 学习笔记

C++ lambada表示的学习

2017-06-07 17:33:09 651

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除