• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

[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