Overriding
Monkey Forums/Monkey Programming/Overriding
| ||
why i can't do that:
Class Foo
Method Bar(x:Int)
' do dirty things with x
End
End
Class FooBar Extends Foo
Method Bar(x:Int, y:Int)
' x does dirty things with y
End
End
|
| ||
| Monkey doesn't allow you to overload an inherited method. Why? I could hazard a guess as to the motivation, but it wouldn't help you. You need to change the method name or bring your new method up the inheritance tree. |
| ||
| The method Bar needs to be identical in parameters for both methods base and extended. Apparently it's normal behavior. I didn't like it either but I had to do a work around with my game. Such as: Method bar(x:int=0,y:int = 0) End Method and apply it to both classes. |