Always try to pass objects by reference in C++ in funcation calls as it offers following advantages -
1. Efficient -
Pass by refernce just uses aliases for the object being passed. It does not make copy of the object.
2. Safe -
As reference variable is used for passing the object, possibility of NULL value is avoided.
3. Multiple value return -
Using the reference variable, one can make changes to the members of the object and return as a reference object. Thus, many changed values can be returned.
Wednesday, May 6, 2009
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment