#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();
}
Location g() 怎么理解?一个函数可以是一个类吗?B=g()又是什么意思?为什么一个函数可以赋值给一个类对
MMTTMM
慕婉清6462132