Loading video...
Functions, Part 2
- A function may have “call by value” parameters, where the caller provides input arguments for the function to work on. The function is free to change the values of these parameters without affecting the caller. Where possible, this is the preferred method to increase isolation and maintainability.
- A function may have “call by reference” parameters, where the caller expects the function to return new values for the input arguments.
- A function may have “call by address” parameters, where the caller passes pointers as parameters.
- A function may have default parameters that provide a default value for any argument not provided by the caller.
- Each function usually has exactly one return value, or the caller’s “answer”, that will be used by the caller.
- Functions may be overloaded which allows the same function name to be used with different prototypes.
- Functions are crucial to creating modular code, avoiding code duplication, allowing more readable and reusable code. Readable code is easier to maintain. Reusable code saves time and effort. Modules should be insulated from their containing systems to decrease external dependencies, and increase reusability
- Here are links to more information about C++ functions: http://www.cplusplus.com/doc/tutorial/functions/ http://www.cplusplus.com/doc/tutorial/functions2/
Functions, Part 2
Lecture Slides are screen-captured images of important points in the lecture. Students can download and print out these lecture slide images to do practice problems as well as take notes while watching the lecture.

































Start Learning Now
Our free lessons will get you started (Flash® 10 required).
Sign up for Educator.comGet immediate access to our entire library.
Features Overview