What is the difference between these two ways of writing a function in C ++? Do they both โfollow the linkโ? By "pass by reference" I mean that the function has the ability to modify the original object (if there is no other definition, but this is my intention).
From my understanding, when you call f1, you pass the โsynonymโ of the original object. When you call f2, you pass a pointer to the object. Does f2 call create a new object *, while f1 does nothing?
f1 (Object& obj) {}
f2 (Object* obj) {}
Thank!
source
share