随笔 - 91  文章 - 0  评论 - 0  阅读 - 94314
11 2022 档案
C++函数的重载
摘要:// 同一作用域下// 函数名称相同// 函数参数类型不同 或者 个数不同 或者顺序不同//注意函数的返回值不可以作为函数的重载条件void func(int a){ cout << "函数的重载" << endl; } void func(int a, int b){ cout << "函数的重载 阅读全文
posted @ 2022-11-18 10:05 知了不了了之 阅读(20) 评论(0) 推荐(0) 编辑
C++ 函数之占位参数
摘要:void func(int a, int){ cout << "占位参数" << endl; } //占位参数之默认参数 void func2(int a, int =10){ cout << "占位默认参数" << endl; } int main(){ func(1, 1); func2(1); 阅读全文
posted @ 2022-11-17 22:25 知了不了了之 阅读(70) 评论(0) 推荐(0) 编辑
C++ 函数的形参之默认参数
摘要:// 如果某个位置参数有默认值,那么从这个位置往后,从左向右,必须都有默认值int func( int a , int b=10){ return a+b; }//一个错误示范 int func( int a , int b=10 ,int c ){ return a+b +c; } int mai 阅读全文
posted @ 2022-11-17 22:16 知了不了了之 阅读(51) 评论(0) 推荐(0) 编辑
new 在堆内存中开辟内存空间,delete 释放开辟的内存空间
摘要:int main(){ int * p = new int(10); cout << *p << endl; delete p; cout << *p << endl; int * arr = new int[10]; for(int i=0; i< 10 ; i++){ arr[i] = i +1 阅读全文
posted @ 2022-11-15 23:27 知了不了了之 阅读(22) 评论(0) 推荐(0) 编辑
C++ 内存分区模型
摘要:代码区: 存放函数的二进制代码,由操作系统管理 全局区: 存放全局变量、静态变量以及常量。 栈区:由编译器自动分配释放,存放函数的参数值,局部变量等 堆区:由程序员分配和释放,若程序员不释放,程序结束时由操作系统回收 代码区: 存放CPU执行的机器指令 代码区是共享的,共享的目的是对于频繁被执行的程 阅读全文
posted @ 2022-11-15 23:11 知了不了了之 阅读(21) 评论(0) 推荐(0) 编辑
Content type 'application/octet-stream' not supported for bodyType=boolean",
摘要:@PostMapping("upload") public Result add( @RequestPart(value = "startTime") String startTime, @RequestPart(value = "id") String id, @RequestPart(value 阅读全文
posted @ 2022-11-10 14:34 知了不了了之 阅读(1297) 评论(0) 推荐(0) 编辑
springboot webflux security 在filter中获取用户名
摘要:exchange.getSession(). subscribe(webSession -> { Object spring_security_context = webSession.getAttribute("SPRING_SECURITY_CONTEXT"); if (Optional.ofN 阅读全文
posted @ 2022-11-03 15:33 知了不了了之 阅读(363) 评论(0) 推荐(0) 编辑
Springboot webFlux filter 获取 requestBody
摘要:public Mono<ServerHttpRequest> generateNewRequest(ServerHttpRequest request) { return DataBufferUtils.join(request.getBody()) .map(dataBuffer -> { byt 阅读全文
posted @ 2022-11-03 15:33 知了不了了之 阅读(861) 评论(0) 推荐(0) 编辑
C++ 常量引用,用来修饰形参,防止误操作
摘要:void func(const int &b){ b=1000;// cout << b << endl; } int main(){ int a =10; //const int &b = 10; //10是一个常量 int a =10 实际是 const int &b = 10; int &b 阅读全文
posted @ 2022-11-02 23:15 知了不了了之 阅读(27) 评论(0) 推荐(0) 编辑
C++ 引用的本质就是一个指针常量
摘要:// int * const b = &a; void func(int &b){ // *b = 100 b= 100; } int main(){ int a = 10; // int * const b = a; 指针常量是指针方向不可修改,也说明引用不可修改 int &b = a; // * 阅读全文
posted @ 2022-11-02 22:49 知了不了了之 阅读(55) 评论(0) 推荐(0) 编辑
C++ 引用作为返回值
摘要:// 不要反悔局部变量的引用 int& test0(){ int a = 10; return a; } // 函数的调用可以作为左值 int& test1(){ static int a = 10; //静态变量,存放在全局区,全局区上的数据在成勋结束后系统释放 return a; } int m 阅读全文
posted @ 2022-11-02 22:35 知了不了了之 阅读(25) 评论(0) 推荐(0) 编辑
c++ 引用作为参数传递
摘要://值传递 void swap(int a , int b){ int tmp = a; a = b ; b = tmp ; cout << "swap a " << a << endl; cout << "swap b " << b << endl; } //地址传递 void swap2(int 阅读全文
posted @ 2022-11-02 22:17 知了不了了之 阅读(17) 评论(0) 推荐(0) 编辑
c++ 引用注意事项
摘要:int main() { /** 引用注意事项 1. 引用必须初始化 2. 引用初始化后就不能更改 */ int a = 10; int c = 100; // int &b; // 引用必须初始化 int &b = a; // int &b = c; //引用初始化后,就不能更改 b = c; / 阅读全文
posted @ 2022-11-02 21:44 知了不了了之 阅读(28) 评论(0) 推荐(0) 编辑
C++ 引用为变量起别名
摘要:引用的基本使用 int main() { // 给变量起别名 //语法 数据类型 &别名 = 变量名 int a = 10; int &b = a; cout << "a " << a << endl; cout << "b " << b << endl; b = 100; cout << "a1 阅读全文
posted @ 2022-11-02 21:31 知了不了了之 阅读(45) 评论(0) 推荐(0) 编辑

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

点击右上角即可分享
微信分享提示