摘要: 点击查看代码 #include<iostream> using namespace std; // prototype class Img { public: static void FindAndClone() { for (int id = 0; id <= count; ++id) { _Pr 阅读全文
posted @ 2022-07-26 22:22 locker_10086 阅读(6) 评论(0) 推荐(0) 编辑
摘要: [= delete] using private constructor: application-1: 点击查看代码 #include<iostream> using namespace std; class B; class A { friend class B; private: A() {} 阅读全文
posted @ 2022-07-24 18:35 locker_10086 阅读(14) 评论(0) 推荐(0) 编辑
摘要: [remove_reference] 点击查看代码 #include<iostream> using namespace std; template<typename Tp> class remove_ref { public: typedef Tp type; }; template<typena 阅读全文
posted @ 2022-07-24 18:18 locker_10086 阅读(18) 评论(0) 推荐(0) 编辑
摘要: [pass by left-value refernece] [pass by right-value refernece] 点击查看代码 #include<iostream> #include<vector> using namespace std; void print(int &&param) 阅读全文
posted @ 2022-07-24 18:13 locker_10086 阅读(10) 评论(0) 推荐(0) 编辑
摘要: lamda can be as an inline function or a object. [how to understand "lamda", comparing with class] [lamda introducer: pass value or reference ] [spec: 阅读全文
posted @ 2022-07-24 00:58 locker_10086 阅读(175) 评论(0) 推荐(0) 编辑
摘要: 1.基础 懒汉模式与饿汉模式 点击查看代码 #include<iostream> using namespace std; class Singleton{ private: Singleton() {}; public: void print() { cout << "i am singleton 阅读全文
posted @ 2022-06-19 19:16 locker_10086 阅读(11) 评论(0) 推荐(0) 编辑
摘要: 前言:虚函数、继承、模板函数、模板类基础知识 点击查看代码 #include<iostream> #include<memory> #include<list> using namespace std; class Observer; //抽象目标 class Subject{ public: vi 阅读全文
posted @ 2022-06-19 01:27 locker_10086 阅读(26) 评论(0) 推荐(0) 编辑
摘要: 继承类(子类)继承基类(父类)的成员变量,及其函数的访问权。 继承访问权限参考链接:https://blog.51cto.com/967243153/2064579 1.类的方法(函数)(访问权)的继承 1.1 子类继承父类的虚函数和非虚函数 点击查看代码 #include<iostream> us 阅读全文
posted @ 2022-06-18 14:56 locker_10086 阅读(18) 评论(0) 推荐(0) 编辑
摘要: 函数指针与回调函数, 类似于Template Method 老师的要求 9:00 eat 9:00 -11:00 work, 让学生自己安排工作 21:00 run 学生执行要求 9:00 eat 9:00 -11:00 work,学生在此时间段想起来要写 code 21:00 run 点击查看代码 阅读全文
posted @ 2022-06-18 02:11 locker_10086 阅读(13) 评论(0) 推荐(0) 编辑
摘要: 下文主要讲述函数指针,为了防止与指针函数区分,首先理解两句话。 第一:指针函数是函数,其返回值为指针。 第二:函数指针是指针,是一种指针类型。 1.函数指针的基础知识 函数指针的声明、定义和使用如代码部分所示: 首先明确:函数指针是一种指向函数的指针,类比int类型的指针进行理解。 自然语言的表述: 阅读全文
posted @ 2022-06-18 02:05 locker_10086 阅读(138) 评论(0) 推荐(0) 编辑