I recently discovered that you can define multiple methods with the same name as long as their arguments differ (I believe it's called method overloading). So for example, in a script I have a method called getDate(int date) and another called getDate(). The only differences between these methods is that the one that doesn't accept an argument uses a static integer defined in the class instead of the date argument.
I've used this logic for at least 5 different methods in the class, however it seems very messy to be duplicating code like this. Is there a more elegant solution?
public DateTime getDate() { return getDate(staticInt); }? This would reuse the overload with the parameter by calling it, instead of copying the code. In any case, you should probably post your code so that we can see exactly what we're dealing with here, the devil is in the details and all that.