• 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.

[vJASS] Help with stub method

Status
Not open for further replies.
Level 2
Joined
Jan 26, 2020
Messages
8
Hey guys

I have a stub method in a parent struct and I want it to be called ONLY if it is overrriden in a child struct.
What's the best way to do this?

I was hoping something like this would work:
JASS:
struct parentstruct
    stub method onPeriodic takes nothing returns nothing
    endmethod

    private static method periodic takes nothing returns nothing
        if this.onPeriodic != null then
            call this.onPeriodic()
        endif
    endmethod
endstruct

Thank you :)
 
Level 2
Joined
Jan 26, 2020
Messages
8
My concern was indeed the performance of calling multiple do nothing-stub methods. I suppose the performance wouldn't be any better with multiple if statements anyways.
Thanks Anachron
 
Status
Not open for further replies.
Top