C, , . , get_ii , . .
If you write C ++ style, you must return by value or return a smart pointer or take a link and change the object through this link. Or you can use C-style and pass a pointer. Some C ++ authors prefer to skip the pointer because it makes it clear that the object is changing and the reference passage is unclear.
Now, if the object is small, as in this example, you should always pass and return it by value. It is faster and cheaper than using a pointer, and it makes coding simpler.
source
share