Summary

In this hour, you learned that passing objects by reference can be more efficient than passing by value. Passing by reference also enables the called function to change the value in the arguments back in the calling function.

You saw that arguments to functions and values returned from functions can be passed by reference, and that this can be implemented with pointers or with references.

You learned how to use const pointers and const references to safely pass values between functions while achieving the efficiency of passing by reference.

Get Sams Teach Yourself C++ in 24 Hours, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.