joscha.alisch
10/16/2017, 7:03 PMval
property with a subtype of the original type without problem, but trying the same with a var
property fails?
open class Parent {
open val valProperty : Parent
get() = Parent()
open var varProperty: Parent
get() = Parent()
set(value) {
// doing something
}
}
class Child : Parent() {
override val valProperty : Child
get() = Child()
override var varProperty: Child
get() = Child()
set(value) {
// doing something
}
}
IntelliJ error message is: Var-property type is Child which is not a type of overriden public open var varProperty: Parent defined in ...