- Joined
- Mar 3, 2006
- Messages
- 1,564
This is from a tutorial made by Nestharus (here)
it gives me error like this:
"Member redeclared : destroy"
and I don't know why it is not working, any help ?
JASS:
struct MyStruct extends array
private static integer instanceCount = 0
private static thistype recycle = 0
private thistype recycleNext
static method create takes nothing returns thistype
local thistype this
//first check to see if there are any structs waiting to be recycled
if (recycle == 0) then
//if recycle is 0, there are no structs, so increase instance count
set instanceCount = instanceCount + 1
set this = instanceCount
else
//a struct is waiting to be recycled, so use it
set this = recycle
set recycle = recycle.recycleNext
endif
//perform creation code
return this
endmethod
method destroy takes nothing returns nothing
//add to recycle stack
set recycleNext = recycle
set recycle = this
endmethod
endstruct
"Member redeclared : destroy"
and I don't know why it is not working, any help ?