![](https://img-blog.csdnimg.cn/20200218155555904.jpg?x-oss-process=image/resize,m_fixed,h_224,w_224)
设计模式
记录用到的设计模式
三石目
略知一二机器视觉
展开
-
设计模式:xmind思维导图
原创 2020-02-24 09:48:07 · 651 阅读 · 0 评论 -
设计模式:单例模式
通过单例模式可以保证系统中,应用该模式的类一个类只有一个实例。即一个类只有一个对象实例。例如特定情况下的相机、运动控制卡等硬件实例都可以用单例,避免出现重新构造时出错。一般使用饿汉模式,在类加载时就完成了初始化,所以类加载比较慢、获取对象的速度快、以空间换取时间模式、线程安全。#include "pch.h"#include <iostream>using name...原创 2020-02-20 10:15:41 · 133 阅读 · 0 评论 -
设计模式:抽象工厂模式
C++实现,以运动控制卡为例。#include "pch.h"#include <iostream>using namespace std;/*操作运动的类*/class InterRUN{public: virtual void Home() = 0; virtual void SetSpeed(int) = 0;};class GugaoRUN : ...原创 2020-02-19 11:52:20 · 246 阅读 · 0 评论 -
设计模式:模板方法模式
#include "pch.h"#include <iostream>using namespace std;class Process{public: virtual void before() { cout << "before!" << endl; } void Run() { before(); cout <&l...原创 2020-02-18 15:51:56 · 117 阅读 · 0 评论