properties in mixins
Posted: Sun Nov 11, 2012 4:24 am
the following code doesn't compile due to "error: Cannot use the from form of a property inside an interface declaration."
refering to the getter.
Are properties prohibited in mixins, or is this a mistake?
Thanks, kobi
refering to the getter.
Are properties prohibited in mixins, or is this a mistake?
- Code: Select all
mixin ManageAttitude
var _attitude as decimal
get attitude from _attitude
def happierBy(n as decimal)
require
n >= 0.0 and n<=1.0
body
_attitude = Math.min(1.0, .attitude + n) # atmost
def sadderBy(n as decimal)
require
n >= 0.0 and n<=1.0
body
_attitude = Math.max(0.0, .attitude - n) # atleast
Thanks, kobi