- Passing by reference allwos a called functioto access variables in the calling fucntion. C++'s addition of the feature is a bread from C, whice only passes by value. Passing by value, recall, results in the called function working with copies of values from the callinig program. Of course, C lets you get around the passing by value limitation by using pointers.
- You should initialize a reference variable when you declare it.
- A reference is rather like a const pointer.
Passing by value Versus Passing by reference
最新推荐文章于 2020-11-10 16:30:49 发布