fork download
  1. type
  2. A* = ref object of RootObj
  3. a: int
  4. B = ref object of A
  5. b: int
  6.  
  7. proc newA*(
  8. a: int
  9. ): A =
  10. return A(a: a)
  11.  
  12. proc newB*(
  13. aObj: A,
  14. b: int
  15. ): B =
  16. result = B(aObj)
  17. result.b = b
  18.  
  19. discard newB(newA(1), 2)
Runtime error #stdin #stdout #stderr 0s 2372KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
Traceback (most recent call last)
prog.nim(19)             prog
prog.nim(16)             newB
Error: unhandled exception: invalid object conversion [ObjectConversionError]