The correct way to do it is this: type BObj = object aref: ref AObj name: string proc `=destroy`(x: BObj) = echo "Destroying B named ", x.name `=destroy`(x.aref) `=destroy`(x.name) Run
Strings must be destroyed too.
The correct way to do it is this: type BObj = object aref: ref AObj name: string proc `=destroy`(x: BObj) = echo "Destroying B named ", x.name `=destroy`(x.aref) `=destroy`(x.name) Run
Strings must be destroyed too.