A::A(int i):a(i),尤其a(i) #include class A{public:\x05A(int i);\x05void print();\x05const int &r;private:\x05const int a ;\x05static const int b;};const int A::b=10;A::A(int i):a(i),r(a){}void A::print(){\x05cout

来源:学生作业帮助网 编辑:作业帮 时间:2024/11/14 20:11:57
A::A(int i):a(i),尤其a(i) #include class A{public:\x05A(int i);\x05void print();\x05const int &r;private:\x05const int a ;\x05static const int b;};const int A::b=10;A::A(int i):a(i),r(a){}void A::print(){\x05cout
xRJ@Am]Ib!fv1PҐGBH@Bm+]XVﴮ3156MsNsݩjHU,YMS ݹR:IH(+Whܣ!CHn``jB:!$.faq Xf\!(W=_O

A::A(int i):a(i),尤其a(i) #include class A{public:\x05A(int i);\x05void print();\x05const int &r;private:\x05const int a ;\x05static const int b;};const int A::b=10;A::A(int i):a(i),r(a){}void A::print(){\x05cout
A::A(int i):a(i),尤其a(i)
#include
class A
{
public:
\x05A(int i);
\x05void print();
\x05const int &r;
private:
\x05const int a ;
\x05static const int b;
};
const int A::b=10;
A::A(int i):a(i),r(a)
{}
void A::print()
{
\x05cout

A::A(int i):a(i),尤其a(i) #include class A{public:\x05A(int i);\x05void print();\x05const int &r;private:\x05const int a ;\x05static const int b;};const int A::b=10;A::A(int i):a(i),r(a){}void A::print(){\x05cout
这是初始化赋值,A::A(int i):a(i),r(a)这是构造函数.意思是,创建类型A时,将参数i 赋值给A中的成员a,a的值又赋值给成员r.