1 2 3 4 5 ··· 19 下一页
摘要: 策略模式(Strategy Pattern)是一种行为型设计模式,其核心思想是定义一组算法,将每个算法封装为独立的类,使它们可以互相替换12。该模式通过将算法与使用它的客户端解耦,实现运行时动态切换算法,避免使用多重条件判断语句(如if-else) 核心特点 算法封装:每个算法被封装为独立的策略类, 阅读全文
posted @ 2025-11-10 09:16 于光远 阅读(4) 评论(0) 推荐(0)
摘要: 单例模式,指的是,在一些特定的场景当中,某一些类只能创建出一个实例(对象)。无论是单线程还是多线程环境下面,都只能生成一个对象,这个时候,就需要使用到单例模式。 主要是为了防止一个类实例化多个对象造成数据不一致问题或者造成资源消耗问题(构建过程中的时间消耗、内存消耗) 怎么设置单例模式 私有化构造函 阅读全文
posted @ 2025-11-10 09:14 于光远 阅读(4) 评论(0) 推荐(0)
摘要: 左值 右值 (纯右值,将亡值) 可以在等号左边 只能在等号右边 能够取到地址 不能取地址 具名 不具名 1. 变量名 2.返回左值引用的函数 3.解引用 (*this) 4. ++i是左值 5. 声明出来的左值引用 6.右值引用 1.返回非引用类型的函数调用 (int func(void)) 2.i 阅读全文
posted @ 2024-05-07 13:30 于光远 阅读(53) 评论(0) 推荐(0)
摘要: #!/bin/bash now=$(/bin/date +%y%m%d%H%M%S%N) echo $now $line 阅读全文
posted @ 2022-08-03 14:12 于光远 阅读(95) 评论(0) 推荐(0)
摘要: App调用接口,依赖头文件和库。 库文件更新,App代码不需要重新编译,直接就可以运行。 //main.cpp //main.cpp #include "IStudent.h" int main(){ getIStudent()->TellStory(); } //IStudent.h//#prag 阅读全文
posted @ 2022-07-14 20:21 于光远 阅读(128) 评论(0) 推荐(0)
摘要: #include <iostream> #include <tuple> using namespace std; template<class... Args> class student{ public: template<typename HEAD> void displayParam(con 阅读全文
posted @ 2022-07-13 18:23 于光远 阅读(57) 评论(0) 推荐(0)
摘要: #include <iostream> using namespace std; #define INITIALIZER(f) \ static void f(void) __attribute__((constructor)); \ static void f(void) #define DEIN 阅读全文
posted @ 2022-03-10 18:56 于光远 阅读(53) 评论(0) 推荐(0)
摘要: #include <iostream> using namespace std; class interface{ public: virtual int getAge()=0; virtual int getAge1()=0; }; class person:virtual public inte 阅读全文
posted @ 2022-03-10 15:58 于光远 阅读(89) 评论(0) 推荐(0)
摘要: #include <iostream> #include <iostream> #include <string> class test{ public: test(const std::string _domain,const std::string _interface,const std::s 阅读全文
posted @ 2022-03-10 14:26 于光远 阅读(659) 评论(0) 推荐(0)
摘要: Linux系统eeprom bit 可能会用,可有可无 一般MCU会使用,也有的时候诊断信息会存在mcu内部nor flash里(RH850)nor flash byte 根据芯片决定的,有的芯片不支持nand flash启动,就需要从nor flash启动(sram,ddr内存的读取结构相同)na 阅读全文
posted @ 2021-09-07 16:23 于光远 阅读(220) 评论(0) 推荐(0)
1 2 3 4 5 ··· 19 下一页