← Back to team overview

ooc-dev team mailing list archive

Overriding data fields

 

Would't it be nice to be allowed to override a data field with a property?
I'm trying to do so but I can see it's not possible. I don't know if it is a
bug, a planned feature but not implemented, or just something not supported
by ooc.
I'm testing this code:

import structs/LinkedList

A:class {
pos:Int
}

AA:class extends A {
}

AB:class extends A {
pos:Int {
set(p) {
pos = p
println("pos was setted on AB")
}
get {pos}
}
}

setpos(A new())
setpos(AA new())
setpos(AB new())

setpos: func(a:A) {
a pos = 4
}

Nothing prints in the output. I would have expected "pos was setted on AB"
Also, not error or warning is given by ooc.

Thanks!