Super & Properties
Monkey Forums/Monkey Bug Reports/Super & Properties
| ||
Hi mark, not sure if this is a bug but it looks suspicious. Strict Function Main:Int() Local test:AnotherClass = New AnotherClass() test.A = 123 test.B(456) Return 0 End Class AnotherClass Extends BaseClass Method A:Void(value:Int) Property Super.A = value End Method B:Void(value:Int) Super.B(value) End End Class BaseClass Method A:Void(value:Int) Property End Method B:Void(value:Int) End End This also: Strict Function Main:int() New AnotherClass().A = 12 Return 0 End Class AnotherClass Extends BaseClass Method A:Int() Property Return 0 End End Class BaseClass Method A:Int() Property Return 0 End Method A:Void(value:int) Property End End |
| ||
I have found that the following works for dealing with super properties (as per your first example)..... Class AnotherClass Extends BaseClass Method A:Void(value:Int) Property Super.A(value) End Method B:Void(value:Int) Super.B(value) End End ... Also of note in the above example: "test.B = 456" causes a syntax error, it should be "test.B(456)" as B is not a property. I agree that super properties should be accessed in the assignment notation, as to if its a bug I do not know. As for what you are trying to do in the second example, I am unsure. |
| ||
Also of note in the above example: "test.B = 456" causes a syntax error, it should be "test.B(456)" as B is not a property. oh my! Too early in the morning for bug reports. As for what you are trying to do in the second example, I am unsure. arg, another typo. The Property gets overridden to change it's behaviour. But it appears that overriding a get property also requires to override the set property (and vice versa). I am not sure which if any platform enforces this but it feels awkward. |