References Required
As you may recall from Chapter 5, when we call a function, the arguments to that function are actually copies of the data passed in from the calling function; that is, a new local variable is created and initialized to the value of each expression from the calling function and the called function works on that local variable. Such a local variable is called a value argument, because it is a new variable with the same value as the caller's original argument. There's nothing wrong with this in many cases; sometimes, though, as in the present case, we have to do it a bit differently. A reference argument, such as the ifstream& argument to Read, is not a copy of the caller's argument, but another name for the actual argument ...
Get Learning to Program in C++ 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.