| 05-08-2007, 02:18 PM | #1 | ||
Kay when i was learning vJass here, these few lines confused me, hope that some vJass experts can answer some question here Quote:
JASS:struct somestruct real x = 1 real y = 2 method add takes nothing returns real return (.x+.y) endmethod static method add2 takes nothing returns real return (.x+.y) endmethod endstruc Quote:
mmm this part i was totally lost, basically have no idea what interfaces is thanks to all teachers that willing to teach a student here ![]() |
| 05-08-2007, 02:24 PM | #2 |
static methods are non-instance methos, they are just normal functions that can use private stuff in an struct. JASS:struct A static integer i=0 static method q takes integer x returns nothing set A.i = A.i+x endmethod method r takes integer v returns nothing call A.q(v+4) endmethod endstruct function B takes nothing returns nothing call A.q(56) endfunction |
| 05-08-2007, 04:25 PM | #3 |
interface is like a struct chooser if u put it that way. It choose to use a method from the correct struct depends on the parameter. This is in case 2 structs has method of same name but different parameter. this is like function overload in C++ |
| 05-08-2007, 06:20 PM | #4 |
uh uh... i guess i somehow understand better... since i never learn C++ in the first place lol, jass was my first programming languague thanks~ |
