HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

some onDestroy question...

12-14-2007, 07:04 AM#1
zen87
Collapse JASS:
struct father
    method onDestroy takes nothing returns nothing
        BJDebugMsg("papa destroyed")
    endmethod
endstruct

struct son extends father
    method onDestroy takes nothing returns nothing
        BJDebugMsg("baby destroyed")
    endmethod
endstruct

okay, if I called onDestroy on the struct son, this will appear right?
son destroyed
baby destroyed

however if I called OnDestroy on the struct father, what will appear? Just wondering hows the sequence of the onDestroy method in a struct that extends each other...
12-14-2007, 07:53 AM#2
grim001
if you create a father then destroy it, only father's onDestroy will happen

if you create a son then destroy it, first son's onDestroy will be called, then father's
12-14-2007, 11:15 AM#3
Toadcop
lol... this may screw some stuff up.
(so be careful)
12-14-2007, 12:24 PM#4
Vexorian
Yes, for example if you expected the order to be totally random it would "screw" your stuff. It would also screw your stuff if you expected the baby to run onDestroy even when you just destroy the parent...
12-14-2007, 01:41 PM#5
zen87
alright thanks guys, i guess i know what's wrong with the code im working on...