Home > Back-end >  Problems the basis of [c]
Problems the basis of [c]

Time:03-22

Want to understand to return to the class type and return a reference to the class type have what distinction, deep thinking and found a problem didn't understand, then ask:
1. As shown in figure, an object called b1 fun1 member function, the * this is to return to who? To b1 yourself?
2. Why call returns directly call set function, class type fun1 then set function didn't work? B1. Fun1 () returns * this or b1 itself, then b1. The set (5) not directly into a 5? Why only returns the reference in order to get rid of?

CodePudding user response:

A function has a return value, accept the return value, with a variable will be copied,
  • Related