• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[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