输出有问题VC6.0
#include <iostream.h>struct sample
{
private:
int length, width, s;
public:
sample(int i, int j)//构造函数
{
length = i;
width = j;
s = length * width;
cout << s <<'\t' << "构造函数被调用"<< endl;
}
~sample()
{
cout << length <<'\t'<< width << '\t' ;
cout << s <<'\t' << "构造函数被调用"<< endl;//这句话输出有问题呀?
//cout << s << '\t'<< "析构函数被调用"<<endl;
}
sample(const sample &);
};
sample :: sample( const sample &obj1)
{
length = obj1.length;
width = obj1.width;
cout <<"赋值构造函数被调用"<<endl;
}
void main()
{
sample obj1(15, 6);
sample obj2(obj1);
sample obj3 = obj1;
}