自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 C++设计模式之外观模式

//外观模式, #include<iostream> using namespace std; class stock1 { public: void Buy() { cout << "股票1买入" << endl; } void Sell() { cout << "股票1卖出...

2018-09-06 19:27:34 168

原创 设计模式之建造者模式

#include<iostream> using namespace std; class People { public: virtual void CreateHead() = 0; virtual void CreateHand() = 0; virtual void CreateBody() = 0; virtual void CreateF...

2018-09-05 20:53:34 157

原创 C++设计模式之观察者模式

//观察者模式, #include<iostream> #include<string> #include<vector> using namespace std; class AbstractBoss; class AbstractWorker { public: virtual void update() = 0; }; class Stoc...

2018-09-05 20:27:34 196

原创 C++设计模式之抽象工厂模式

//抽象工厂模式,提供一个创建一系列相关或者相互依赖对象的接口,二无需制定他们 //具体的;类 #include<iostream> using namespace std; class List_7 { public: virtual void product() {}; virtual void sell() {}; }; class VIVO_7 :publi...

2018-09-05 16:04:05 314

原创 C++设计模式之状态模式

//状态模式,当一个对象的内在状态改变时,语序改变其行为,这个对象看起来像是改变了其类 #include<iostream> using namespace std; class State; class Forenoon; class Noon; class Afternonn; class Evening; class GoHome; class Work; class Sta...

2018-09-05 15:17:36 792 1

原创 设计模式之适配器模式

//设计模式之适配器模式 //类适配器和对象适配器 /*适配器模式将类的接口转化成客户希望的另一个接口,适配器模式使得原本由于 接口不兼容而不能一起工作的那些类可以一起工作*/ #include<iostream> #include<string> using namespace std; class Player { string m_name; public:...

2018-09-03 21:08:24 126

原创 设计模式之备忘录模式

//C++设计模式之备忘录模式 /*备忘录模式,在不破坏封装的前提下,捕获一个内部状态,在该对象之外保存这个 状态,*/ #include<iostream> using namespace std; class State { int vit; int atk; int def; public: State(int v, int a, int d...

2018-09-03 19:59:38 172

原创 设计模式之组合模式

//设计模式之组合模式 /*组合模式将对象组合成树形结构表示部分整体的层次结构,使得用户对单个对象和组合 对象的使用具有一致性 透明方式和安全方式,在component中声明用来管理子对象的方法,这样实现的所有 component接口的所有子类都具备父类具有的功能,具有完全一致的行为接口。 安全方式在接口中不声明remove和add的方法,子类也就不需要实现它,在component 中声明所有用来...

2018-09-03 19:16:36 181

原创 C++设计模式之桥接模式

//桥接模式,合成,聚合复用原则 #include<iostream> using namespace std; class Soft { public: virtual void run() = 0; }; class Notepad :public Soft { public: void run() { cout << "运行...

2018-09-02 15:26:58 164

原创 C++设计模式之命令模式

/*命令模式,将一个请求封装为一个对象,从而可以用不同的请求进行参数化, 对请求排队或者记录请求日志,以及支持可撤销操作。*/ #include<iostream> #include<string> #include<time.h> #include<list> #include<map> using namespace std; cl...

2018-09-02 14:36:23 195

原创 C++设计模式之中介者模式

//中介者模式 #include<iostream> #include<string> using namespace std; class Country; class UnitedNations { public: virtual void Declare(string message, Country* country) = 0; }; class C...

2018-08-31 21:37:55 205

原创 设计模式之解释器模式

//设计模式之解释器模式 #include<iostream> #include<string.h> #include<stdio.h> using namespace std; class Context { public: char input[30]; char output[30]; }; class Expression { pu...

2018-08-29 21:32:00 137

原创 设计模式之访问者模式

//设计模式之访问者模式 //将操作与数据结构分离开来。适用于数据结构不变,算法经常变化的情况。 #include<iostream> #include<list> using namespace std; class Man; class Woman; class Action { public: virtual void getManCon(Man *ma...

2018-08-29 20:51:28 161

原创 C++设计模式之简单工厂模式

简单工厂模式用于创建对象,添加新类不影响以前的代码。 核心思想是virtual函数的应用,降低层与层之间的耦合度。 //简单工厂模式 #include<iostream> using namespace std; //基类 class COperation { public: int m_nFirst; int m_nSecond; virtual do...

2018-08-28 20:37:19 148

原创 C++一些细节

/*#include<iostream> #include"pthread.h" using namespace std; static pthread_mutex_t* mutex; class Single; class Single { private: Single() {}; public: static Single* instance; st...

2018-08-25 21:48:07 154

原创 C++一些细节

/*#include<iostream> using namespace std; class A { A() { doSth(); } virtual void doSth() { printf("I an A"); } }; class B :public A { public: virtual void doSth()...

2018-08-25 20:19:45 239

原创 Shell 输入输出重定向

大多数linux系统的输入输出的对象都为你的终端,即标准输入输出都是你的终端。重新定义输出输出的命令入下: command >file 将输出重定向到file command ...

2018-08-21 21:13:17 495

原创 linux shell脚本

第一个shell脚本 1,建立shell脚本 打开文本编辑器vi/vim,新建test.sh,输入如下代码: #!/bin/bash echo "Hello World !" 表示脚本需要的解释器 #! 2,运行shell脚本的两种方法 1,作为可执行程序 chmod +x ./test.sh #使脚本具有执行权限 ./test.sh 如果直接写test.sh 系统回去PATH里...

2018-08-20 19:37:53 260

原创 linux yum 命令

yum语法 yum [options] [command] [package ...] options:-h 帮助 -y 安装过程中所有选项为yes -q 不显示安装过程 command: 要进行的操作 package 操作的对象 yum常用命令 1,列出所有可更新的软件清单命令:yum check-update 2,更新所有软件: yum update 3,安装指定软件...

2018-08-19 19:49:39 242

原创 Linux基本操作

一,linux文件基本属性 linux中用 ||或者 ls -l 显示一个文件的属性以及文件所属的用户和组 在linux中,第一个字符便是这个文件是目录文件或者连接文件等。 d 目录 - 文件 / 链接文档 b 可供储存的接口设备 c 串行接口设备 接下来的表示用户权限:三个一组,r-可读 w-可写 x-可执行 接下来为该文件属主和属组 文件权限对root用户不起作用 ...

2018-08-19 16:21:05 285

原创 从Linux开始

前几天安装了VMware虚拟机和Ubuntu系统,并对其有了一个简单的了解。 一,Linux系统启动过程 1,内核的引导。 操作系统接管硬盘后,首先读入/boot下的内核文件。 2,运行init。 init进程是所有系统进程的起点。该程序首先需要读取配置文件/etc/inittab。 Linux有七个运行级别 init 0 停机 init 1 单用户工作,root权限,用于系统...

2018-08-19 13:33:27 227

空空如也

空空如也

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

TA关注的人

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