#include <iostream>
using namespace std;
class Location
{ public :
Location(int xx=0,int yy=0)
{X=xx;Y=yy;cout<<"object constructed."<<endl;}
~Location();
Location(const Location &p );
int GetX()const {return X;}
int GetY() const {return Y;}
private :
int X,Y;
};
Location::~Location()
{ cout<<X<<","<<Y<<"object destroyed."<<endl;
}
Location::Location(const Location &p)
{ X=p.X;Y=p.Y;cout<<"copy constructor called."<<endl;
}
Location g()
{Location A(1,2);return A;}
int main()
{ Location B;B=g();
}
SMILET
素胚勾勒不出你
相关分类