c++中临时对象的问题
class B{ ....};B play (){ B b; return b;}B play2(B b){ return b;}void main(){ 情况一、B t1 = play(); // 会析构2次,因为一次是return b;返回的临时对象,还有一次是t1对象析构 情况二、B t2 = play2(5); // 编译器会析构2次, // 我觉得会是3次,5传入的一次临时对象,return b;返回的临时对象,还一次是t2对象析构}