Skip to content

Latest commit

 

History

History
5 lines (3 loc) · 646 Bytes

7.49.md

File metadata and controls

5 lines (3 loc) · 646 Bytes

(a) Sales_data &combine(Sales_data); The code works correct. It will first convert s to Sales_data, then copy that temporary into the parameter of combine.

(b) Sales_data &combine(Sales_data&); The code is wrong. It will first convert s to Sales_data, then pass the reference to that temporary into the parameter of combine, but passing a reference to a temporary is error.

(c) Sales_data &combine(const Sales_data&) const; The code could not compile, because it should not be a const member function. It will first convert s to Sales_data, then pass the const reference to that temporary into the parameter of combine.