How to implement a custom interface in Realm Model


#1

i have two realm models like below:

open class HerbalDrug : RealmObject(), Drug {

    @SerializedName("id")
    @Expose
    open var id: Int = -1
    
    @SerializedName("form")
    @Expose
    open var form: String = ""
    
}

and

open class ChemicalDrug : RealmObject(), Drug {

    @SerializedName("id")
    @Expose
    open var id: Int = -1
    
    @SerializedName("amount")
    @Expose
    open var form: String = ""
    
}

and an Drug interface :

interface Drug

does realm allow me to do this ?