#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
using namespace std;
class Box
{
public:
Box()
{
cout << "调用构造函数" << endl;
length = new int;
breath = new int;
}
Box(int _length, int _breath)
{
cout << "调用构造函数" << endl;
length = new int;
breath = new int;
*length = _length;
*breath = _breath;
}
Box(const Box& box)
{
length = new int;
breath = new int;
*length = *box.length;
*breath = *box.breath;
}
~Box()
{
cout << "调用析构函数" << endl;
delete length;
delete breath;
}
void get()
{
cout << "length = " << *length << endl;
cout << "breath = " << *breath << endl;
}
private:
int* length;
int* breath;
};
int main()
{
//Box box1(1, 2);
//Box box2 = box1;
Box box3;
return 0;
}