HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Need opinions

03-11-2007, 12:31 PM#1
Vexorian
I want to add operator overloading, although just for [] and < right now

I have this:

Collapse JASS:
struct booya
    method indexSet takes integer i, integer value returns nothing
    endmethod

    method indexGet takes integer i returns integer
        return 0
    endmethod

    method comparelt takes booya x returns boolean
        return true
    endmethod

    
    operator []= extends indexSet
    operator []  extends indexGet

    operator < extends comparelt
endstruct

Alternative:

Collapse JASS:
struct booya
    method []= takes integer i, integer value returns nothing
    endmethod

    method [] takes integer i returns integer
        return 0
    endmethod

    method < takes booya x returns boolean
        return true
    endmethod
endstruct
03-11-2007, 03:05 PM#2
zen87
-Off topic-

uhm vex, i'm still blur about the structs you made in the caster sys, do you have any tutorials about using it ? im still using attach variables :(
03-11-2007, 05:53 PM#3
grim001
the 2nd implementation looks better to me
03-12-2007, 07:31 AM#4
PipeDream
the second one is wonky because of the overlap with functions and the first is a little verbose. How about C++ style method operator< takes ...?