执行如下程序后的输出结果是:#includeclass test...
发布于 2022-03-03 15:20:59
执行如下程序后的输出结果是:
#include
class test{
static int count;
public:
test(){count++;}
~test(){count--;}
static int getCount(){return count;}
};
int test::count=0;
int main()
{
test * p=new test;
test * q=new test;
delete p;
cout<<"count="<<test::getCount()<<endl;
return 0;
}
#include
class test{
static int count;
public:
test(){count++;}
~test(){count--;}
static int getCount(){return count;}
};
int test::count=0;
int main()
{
test * p=new test;
test * q=new test;
delete p;
cout<<"count="<<test::getCount()<<endl;
return 0;
}
登录后免费查看答案
关注者
0
被浏览
28