Functions
- Breaks code down into manageable chunks to write (and divide across development team)
- Easier to debug – only one idea behind each module
- Easier to maintain – buggy modules may be replaced without worrying about ramifications on other modules
- Outsiders only need to know a module’s interface, not the details of its implementation.
- Avoids duplication of code ⇒ more compact, and also easier to modify if code has bug
- Predefined functions: e.g., String.length(): String → Int
- Programmer-Defined functions: used similarly to predefined functions
This predefined functions need using namespace std;
No comments:
Post a Comment