函数回来应该是个右值吧,为啥能放在左边(红色标示的部分)

函数返回应该是个右值吧,为啥能放在左边(红色标示的部分)?1楼class A1{public:A1(){std::coutA1()st

函数返回应该是个右值吧,为啥能放在左边(红色标示的部分)?

1楼class A1{public:    A1()    {        std::cout<<"A1()"<<std::endl;    }    A1(const A1& a1)    {        std::cout<<"A1(const A1& a1"<<std::endl;    }    A1& operator=(const A1& a1)    {        std::cout<<"operator=(const A1& a1)"<<std::endl;    }    int* pi;};A1 GetA(){    std::cout<<" GetA() begin"<<std::endl;    A1 a1;    std::cout<<" GetA() end"<<std::endl;    return a1;} int main(){?? A1 a1;?? GetA() = a1;}
1 楼 deepfuture 2010-11-18   GetA() = a1;
GetA()返回一个类对象,
对象1= 对象2   正常