Talk:Overloading

From CSSEMediaWiki
Jump to: navigation, search

I disagree with this. I think method overloading can make code easier to read, as long as the overloaded methods perform the same basic task. Two areas where it might be useful to overload methods is having default parameters to customise the functionality of the method (for instance, calculateMetrics might have an additional bool specifying whether to compute the extra, CPU intensive metrics which are only sometimes needed). Another time when it might be useful is for different types. If you have a applyMagicFormula(float) method, it might make sense to overload it for ints, to reduce casting.

What do people think? --Lukas Korsika 01:53, 21 October 2010 (UTC)

Personal tools