Theres a rather big chance that I am doing it wrong but..
say I have this code:
- type
- TGameObject = object of TObject PGameObject = ref TGameObject TMonster = object of TGameObject PMonster = ref TMonster
left out all properties
- proc doit(obj: PGameObject) =
- #do stuff
if doit should handle both monsters and general game objects, should I:
- do 2 proc and proc overloading?
- do 1 proc and some pattern matching on the type (how?)
- 2 proc with pattern matching to call it again with obj cast as its base?
- epic nim(rod)-esque badassery?