Wrong assumption about overloading?
Monkey Forums/Monkey Beginners/Wrong assumption about overloading?
| ||
Hi, I am probably doing this under the wrong assumption. That is, that you can overload a method by return value? See my snippet here.. Method GetByName:Float(Name:String) Return Self.myFloats.FindName(Name) End Method GetByName:Int(Name:String) '<-- Duplicate declaration Method error! :( Return Self.myInts.FindName(Name) End So if a# = GetByName("blah") then it would call the 1st method Also, if b% = GetByName("bleh") then it would call the second method? |
| ||
No, you can not overload by return value, only by arguments. |
| ||
no, but you can use generics. |
| ||
Thanks for clearing that up Goodlookinguy. And that's a great suggestion too Adam, thank you, I'll give that a go instead. |