October 2011
Beginner to intermediate
1200 pages
35h 33m
English
You might find function overloading fascinating, but you shouldn’t overuse it. You should reserve function overloading for functions that perform basically the same task but with different forms of data. Also you might want to check whether you can accomplish the same end by using default arguments. For example, you could replace the single, string-oriented left() function with two overloaded functions:
char * left(const char * str, unsigned n); // two argumentschar * left(const char * str); // one argument
But using the single function with a default argument is simpler. There’s just one function to write instead of two, and the program requires memory for just one function instead of two. If ...
Read now
Unlock full access