t4799_3.nim 372 B

1234567891011121314151617181920
  1. discard """
  2. outputsub: '''ObjectAssignmentError'''
  3. exitcode: "1"
  4. """
  5. type
  6. Vehicle = object of RootObj
  7. tire: int
  8. Car = object of Vehicle
  9. Bike = object of Vehicle
  10. proc testVehicle(x: varargs[Vehicle]): string =
  11. result = ""
  12. for c in x:
  13. result.add $c.tire
  14. var v = Vehicle(tire: 3)
  15. var c = Car(tire: 4)
  16. var b = Bike(tire: 2)
  17. echo testVehicle([b, c, v])