fork download
  1. type
  2. BaseT = ref object of RootObj
  3. a, b: int
  4. SubT = ref object of BaseT
  5. c: int
  6.  
  7. proc createBase(base: BaseT) =
  8. base.a = 1
  9. base.b = 2
  10.  
  11. proc createSub: SubT =
  12. result = SubT(c: 1)
  13. procCall createBase(BaseT(result))
  14.  
  15. echo repr(createSub())
  16.  
Success #stdin #stdout 0s 2420KB
stdin
Standard input is empty
stdout
ref 0xb76e4028 --> [c = 1,
a = 1,
b = 2]