摘要: Pointer-like classes像指针又像函数 智能指针概念: 一个类做出来像类又像指针 示例代码: #pragma once#ifndef __SHAREPOINTER__#define __SHAREPOINTER__​template<class T>class shared_ptr{ 阅读全文
posted @ 2024-03-31 13:27 俊king 阅读(15) 评论(0) 推荐(0)
摘要: 泛型编程(Generic Programming) 虚函数 -> 含有虚函数的类就是抽象类 编译(compile) 链接(link) 转换函数(Conversion function) 例如将小数转成分数,就是一个转换函数 #pragma once#ifndef __FRACTION__#defin 阅读全文
posted @ 2024-03-31 13:24 俊king 阅读(20) 评论(0) 推荐(0)
摘要: Composite设计模式 虚函数 继承与父类.又可以携带指针(Delegation) 示例代码: component.h -> 统一父类 #pragma once#ifndef __COMPONENT__#define __COMPONENT__​class Component{ int valu 阅读全文
posted @ 2024-03-31 13:00 俊king 阅读(15) 评论(0) 推荐(0)