Chapter 6. Overloading Functions and Operators
C++ has many features that make life easier for programmers. For example, thinking up unique and meaningful names for functions can be irksome. You saw in Chapter 4, “Programs and Libraries,” how namespaces can keep families of functions together, but even with namespaces, you still need to come up with names such as print_date() and print_person(). With the C++ feature function overloading, you can let one name stand for a number of functions, depending on the arguments. In C++ you can also redefine operators, so you can define a simple notation for common operations on structures. Functions can call themselves, under special conditions, and they can be passed as parameters to other functions.
Get C++ By Example: UnderC Learning Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.