diff options
Diffstat (limited to '01-14.md')
-rw-r--r-- | 01-14.md | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -245,7 +245,7 @@ x coordinate is 4 y coordinate is 6 ``` - A **reference parameter** is declared by writing the type name followed by the character `&` and the parameter name -- With a reference parameter, any use of the parameter within the body of the functino will access the argument from the calling program +- With a reference parameter, any use of the parameter within the body of the function will access the argument from the calling program - Changes made to the formal parameter in the body of the function **will alter the argument** ### Pitfall @@ -285,7 +285,7 @@ cout << d; - The function has two point parameters, and **neither parameter is changed by the function** - `double distance(const point& p1, const point& p2);` -## When the Type of a Function's Return Valeu is a Class +## When the Type of a Function's Return Value is a Class - The type of a function's return value may be a class @@ -470,7 +470,7 @@ istream& operator >>(istream& ins, point& target){ - In the input function, the input is sent to the private member variables! However, only member functions can access private member variables - Two solutions: - To write new member functions to set a point's coordinates and use these member functions within the input function's implementation - - You can grant special permission for the input functino to access the private members of the point class - Called a **Friend Function** + - You can grant special permission for the input function to access the private members of the point class - Called a **Friend Function** --- |