- Joined
- Aug 1, 2013
- Messages
- 4,658
Lets say I have this script:
Doing:
Will print ".b = false"
But doing:
Will also print ".b = false"
How can I run a method in the constructor of A that waits for the constructor of B to be finished?
EDIT:
For now, I will use factories, but if anyone has a better (more eye-candy) idea, then please share.
JASS:
struct A
readonly boolean b
public static method create takes nothing returns thistype
local thistype this = .allocate()
call .doSomething()
return this
endmethod
private method doSomething takes nothing returns nothing
call BJDebugMsg(".b = " + B2S(.b))
endmethod
endstruct
struct B extends A
public static method create takes nothing returns thistype
local thistype this = .allocate()
set .b = true
return this
endmethod
endstruct
Doing:
call A.create()
Will print ".b = false"
But doing:
call B.create()
Will also print ".b = false"
How can I run a method in the constructor of A that waits for the constructor of B to be finished?
I have a Unit struct and a Hero struct.
When a unit is created, I create another unit to show the health bar.
However, heroes have different versions of the health bars.
Hero extends Unit and the check of wether or not the instance is of type Hero, aka
When a unit is created, I create another unit to show the health bar.
However, heroes have different versions of the health bars.
Hero extends Unit and the check of wether or not the instance is of type Hero, aka
return .getType() == Hero.typeid
doesnt detect the hero type until the hero constructor is finished.EDIT:
For now, I will use factories, but if anyone has a better (more eye-candy) idea, then please share.
Last edited: