tkoeniglookup.nim 231 B

123456789101112131415161718
  1. discard """
  2. output: '''x: 0 y: 0'''
  3. """
  4. proc toString*[T](x: T): string = return $x
  5. type
  6. TMyObj = object
  7. x, y: int
  8. proc `$`*(a: TMyObj): string =
  9. result = "x: " & $a.x & " y: " & $a.y
  10. var a: TMyObj
  11. echo toString(a)