C++: Reasons for passing objects by value

前端 未结 8 1352
清酒与你
清酒与你 2021-01-06 12:37

In Java, all variables containing proper objects are actually references (i.e. pointers). Therefore, method calls with these objects as arguments are always \"by reference\"

8条回答
  •  天命终不由人
    2021-01-06 12:52

    If you pass objects to a function by value, that function is free to use those objects as "working" variables without affecting the caller.

提交回复
热议问题