realm-kotlin
realm-kotlin copied to clipboard
Support for polymorphic inheritance
Hi!
I'm trying to use inheritance and delegation pattern in a project. Based on this comment, I assume Realm Kotlin SDK supports inheritance.
However when I tested the following patterns below with the SDK and open the file in Realm Studio, it seems that either the SDK doesn't support inheritance and delegation pattern. Can anybody please shed a light on this please?
Inheritance Pattern
open class ChildClass: RealmObject {
var child = 10
}
class InheritedClass: ChildClass(), RealmObject {
var parent = 20
}
Both child and parent are expected to appear in screenshot of Realm Studio. However, only parent appeared.
Delegation Pattern
interface Interface {
var i: String
}
class ClassImplementingInterface: Interface {
override var i = "PleaseWork"
}
class ClassWithDelegation : Interface by ClassImplementingInterface(), RealmObject {
var j: String = "ShouldWork"
}
Both I and J are expected to appear in screenshot of Realm Studio. However, only J appeared.
Thanks
Hi @thipokch. Inheritance is unfortunately not supported yet.