One common style is to pass input arguments by const reference, and output arguments by pointer. In this style, we don't pass output arguments by non-const reference to more clearly delineate input from output arguments.
Is always passing by reference a bad practice? [duplicate]
-
23-06-2022 - |
Frage
First, I would like to clarify my question here. During my coding development, I found myself passing by reference in my class member functions except for those built-in types. But I have an idea in my mind why wouldn't I use a pointer to pass in an argument (passing by pointers).
Is it a bad practice to pass by reference not passing by pointers?
Lösung
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow