自考新教材-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;
}
运行结果:
标签:show,新教材,void,int,num,p144,Test,自考 来源: https://www.cnblogs.com/duanqibo/p/12270071.html