It works but there is a better way (I took some creative liberties)
type
Base* = object of RootObj
name*: string
age*: uint
job*: string
BaseExt = object of Base
skills: seq[string]
proc `setBase=`(o: var BaseExt, b: Base) =
for child, parent in Base(o).fields(b):
child = parent
var b = Base(name: "Trump", age: 78, job: "Felon")
var body = BaseExt(skills: @[])
body.setBase = b
echo body
Run
- Setter for Base and Inherited Class jk49
- Setter for Base and Inherited Class ElegantBeef
