HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

vJass + help with methods

09-17-2009, 12:58 AM#1
Gamat
Hi, well im not very skilled with vJass and i want to do something, but i don't know how to do it.

I want that when i create a parent struct, it will call the children struct xxx method for example:

Collapse JASS:
struct Main

stub method mymethod takes nothing returns nothing // 
endmethod

static method create takes nothing returns Main
   local thistype t = thistype.allocate()
   call t.mymethod()
   return t
endmethod

endstruct

struct Other extends Main

method mymethod takes nothing returns nothing
   call BJDebugMsg("Main struct has been created")
endmethod

endstruct


Then if i do Main.create() it will show mymethod msg

Well i don't know if it is possible or how can i do it, maybe an alternative or something?

Thanks for your attention
09-17-2009, 04:12 AM#2
YourName
If you do Main.create(), only the main struct get's created.
09-17-2009, 04:26 AM#3
grim001
If you create a Main struct, it is only a Main. You can't call Other methods since it is not an Other.
09-17-2009, 07:37 AM#4
Fledermaus
If you do Other.create() it will show the "Main struct has been created" message, Main.create() will show nothing because it's mymethod doesn't do anything.
09-17-2009, 07:51 AM#5
Anachron
Tried searching? I posted the same thing a week before.

BTW, Fledermaus, "defualt string", shouldn't it be default string?
09-17-2009, 08:36 AM#6
grim001
Quote:
Originally Posted by Fledermaus
If you do Other.create() it will show the "Main struct has been created"

We wish it would do this, but it doesn't. Vex has plans to change that sometime in the next 6 months I hope.
09-17-2009, 11:31 AM#7
Fledermaus
Oh, my bad.