求大神 这道题怎么解 我需要详细说明 谢谢!
classA{inti,j;public:staticintx;public:A(inta=0,intb=0,intc=0){i=a;j=b;x=c;}voidShow(...
class A
{
int i, j;
public:
static int x;
public:
A(int a = 0, int b = 0, int c = 0){ i = a; j = b; x = c; }
void Show(){
cout << "i=" << i << "\t" << "j=" << j << "\t";
cout << "x=" << x << "\n";
}
};
int A::x = 300;
void main(void)
{
A a(10, 20, 30), b(40, 20, 100);
a.Show();
b.Show();
cout << "A::x=" << A::x << "\n"; //可以直接用类名引用
}
好心人帮帮忙吧 快要期末考试了 展开
{
int i, j;
public:
static int x;
public:
A(int a = 0, int b = 0, int c = 0){ i = a; j = b; x = c; }
void Show(){
cout << "i=" << i << "\t" << "j=" << j << "\t";
cout << "x=" << x << "\n";
}
};
int A::x = 300;
void main(void)
{
A a(10, 20, 30), b(40, 20, 100);
a.Show();
b.Show();
cout << "A::x=" << A::x << "\n"; //可以直接用类名引用
}
好心人帮帮忙吧 快要期末考试了 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询