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

来源:学生作业帮助网 编辑:六六作业网 时间:2024/11/17 21:20:13
classA{inti,j;public:staticintx;public:A(inta=0,intb=0,intc=0){i=a;j=b;x=c;}voidShow(){coutclassA{in

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
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

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
类的静态成员变量是不依附于对象的.
它的声明周期远早于对象,因此可以用类名后面加::访问类的共有静态成员.
当然也可以用对象名加上.访问类的公邮静态成员.