Advertisement
Guest User

Untitled

a guest
Feb 19th, 2015
273
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Nim 0.44 KB | None | 0 0
  1. type parentObj = object of RootObj
  2.  
  3. type
  4.     childObj1 = object of parentOBj
  5.     childObj2 = object of parentOBj
  6.  
  7. method whine(self: parentObj) =
  8.     echo "Shutup!"
  9.  
  10. method whine(self: childObj1) =
  11.     echo "But.... mooooooooooooooooom"
  12.  
  13. method whine(self: childObj2) =
  14.     echo "But.... daaaaaaaaaaaaaaaaad"
  15.  
  16. var myseq: seq[parentObj] = @[]
  17.  
  18. myseq.add(childObj1())
  19. myseq.add(childObj2())
  20.  
  21. for obj in myseq:
  22.     obj.whine()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement