摘要: const在类和函数之间的运用 第一种情况简单来说就是如果声明了一个const类但是调用了非const的方法.那么编译会不通过 -> const类只能调用const方法,非const类就都可以调用 示例代码: 宏定义: #pragma#ifndef __CONST_OBJECT__#define _ 阅读全文
posted @ 2024-04-15 18:06 俊king 阅读(2) 评论(0) 推荐(0) 编辑
摘要: 对象模型 - this 通过一个对象来调用一个函数,那么对象的地址就是this 虚函数的模板方法使用方式 template method 示例代码: #pragma#ifndef __THIS_TEMPLATE_MODEL__#define __THIS_TEMPLATE_MODEL__​class 阅读全文
posted @ 2024-04-15 18:05 俊king 阅读(1) 评论(0) 推荐(0) 编辑
摘要: Reference 三种变量 值 -> value 指针 -> pointer 引用 -> reference &取址符 示例代码: #include <iostream>​using namespace std;​int main() { int x = 0; int* p = &x; // in 阅读全文
posted @ 2024-04-15 18:04 俊king 阅读(2) 评论(0) 推荐(0) 编辑