程序填空_8

源程序:

要求输出结果为40

#include <iostream>
using namespace std;

class Test
{
static int x;      //程序填空
public:
Test(int i=0)
{
x=i+x;
}
int Getnum()
{
return Test::x+10;
}
};
int Test::x=30;      //程序填空
void main()
{
Test test;
cout<<test.Getnum()<<endl;
}

 

posted @ 2022-03-20 11:47  bobo哥  阅读(54)  评论(0)    收藏  举报