• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[JASS] Struct Parents

Status
Not open for further replies.
Hello there.

Lets use the 3 ways of fast answering.

Step 1: The Situation.

JASS:
struct Parent
    boolean test
endstruct

struct Child extends Parent
    public method changeTest takes boolean bol returns nothing
    // ?? What goes in here
    endmethod
endstruct

Step 2: The Description
I have a parent and a chields struct. In the chields struct, I want to use the parents struct, without making it static.

Step 3: Your answer! :p
 
Level 11
Joined
Feb 22, 2006
Messages
752
It should work. I use stuff like that all over my map and I don't have any problems.

JASS:
struct A
    string s = ""
endstruct

struct B extends A
    method setString takes string s returns nothing
        set this.s = s
    endmethod
endstruct

function foo takes nothing returns nothing
    local B this = B.create()
    call this.setString("Hello world!")
    call BJDebugMsg(this.s)
endfunction

Function foo should display "Hello world!"

except for those methods marked with stub as overwriteable
Child structs inherit stub methods also; the only difference is that they may be overwritten.
 
Status
Not open for further replies.
Top