关于运行结果的闪现问题(我用的是dev c++ 编译的)
include<iostream>using namespace std;
class box
{
public:
box(int x,int y,int z)
{
chang=x;
kuan=y;
gao=z;
}
virtual void show ()
{
cout<<chang<<" "<<kuan<<" "<<gao<<endl;
}
virtual ~box()
{
cout<<"基类清理"<<endl;
}
protected:
int chang;
int kuan;
int gao;
};
class box1:public box
{
public:
box1(int x,int y,int z,int u):box(x,y,z)
{
color=u;
}
virtual void show()
{
cout<<chang<<" "<<kuan<<" "<<gao<<" "<<color<<endl;
}
virtual ~box1()
{
cout<<"派生类清理"<<endl;
}
protected:
int color;
};
int main()
{
box b(1,1,1);
box1 bb(1,1,1,1);
box *p;
p=&b;
p->show();
p=&bb;
p->show();
system("pause");
return(0);
system("pause");// 我已经用了俩次system("pause");希望能看清点可是,我还是看不到析构函数的输出语句??????
}