0
点赞
收藏
分享

微信扫一扫

自考新教材-p144_4

源程序:

#include <iostream>
using namespace std;

class Test
{
private:
static int num;
public:
Test(int);
void show();
};
int Test::num = 5;
Test::Test(int n)
{
num = n;
}
void Test::show()
{
cout << num << endl;
}
int main()
{
Test t(10);
t.show();
system("pause");
return 1;
}

运行结果:

自考新教材-p144_4_ios

 


举报

相关推荐

0 条评论