文章
3
粉丝
298
获赞
0
访问
31.2k
请问代码问题在哪里,要怎么修改
#include <iostream>
using namespace std;
class AA
{
public:
AA(){x++;number=x;}
static void print()
{cout<<"x is "<<x<<endl;
cout<<"number is "<<number<<endl;}
static void print2()
{cout<<"x is "<<x<<endl;
cout<<"number is "<<number<<endl;}
~AA()
{cout<<number<<"被析构!"<<endl;}
private:
static int x;static int number;
};
int main()
{
AA aobj1,aobj2;
aobj1.print(); aobj2.print2();
AA::print(); AA::print2();
}
登录后发布评论
暂无评论,来抢沙发