tvtable.nim 445 B

123456789101112131415161718192021222324
  1. discard """
  2. targets: "c cpp"
  3. """
  4. type FooBase = ref object of RootObj
  5. dummy: int
  6. type Foo = ref object of FooBase
  7. value : float32
  8. type Foo2 = ref object of Foo
  9. change : float32
  10. method bar(x: FooBase, a: float32) {.base.} =
  11. discard
  12. method bar(x: Foo, a: float32) =
  13. x.value += a
  14. method bar(x: Foo2, a: float32) =
  15. x.value += a
  16. proc test() =
  17. var x = new Foo2
  18. x.bar(2.3)
  19. doAssert x.value <= 2.3
  20. test()