#include<iostream>
using namespace std;
//使用构造函数参数列表的好处
struct A {
A(int i):i(i){}
const int i;
void show(void) {
cout << this->i << endl;
}
};
struct B {
B(int i);
const int i;
};
B::B(int i){
//this->i = i;不是左值
}
int main(void) {
return 0;
}
C++使用构造函数参数列表的好处
最新推荐文章于 2023-10-05 16:58:47 发布