01 2022 档案

摘要:默认参数是静态绑定的,而虚函数是动态绑定的。 默认参数的使用要看指针或者引用本身的类型,而不是对象的类型 #include <iostream> using namespace std; class Base { public: virtual void fun ( int x = 10 ) { c 阅读全文
posted @ 2022-01-26 13:34 Wangtn 阅读(355) 评论(0) 推荐(0) 编辑
摘要:int n=1,m=2; const int* a=&n; cout<<*a<<endl; a=&m; cout<<*a<<endl; int* const b=&n; cout<<*b<<endl; *b=10; cout<<*b<<endl; const int* a中,const修饰变量,表示 阅读全文
posted @ 2022-01-25 10:37 Wangtn 阅读(266) 评论(0) 推荐(0) 编辑
摘要:类似于这个例子 #include <iostream> using namespace std; void sw(int a,int b) { int tmp=a; a=b; b=tmp; } void sw1(int* a,int* b) { int tmp; tmp=*a; *a=*b; *b= 阅读全文
posted @ 2022-01-06 11:04 Wangtn 阅读(421) 评论(0) 推荐(0) 编辑

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