Arrays in interfaces?

Magentix

if (OP.statement == false) postCount++;
Reaction score
107
Is there any way to do this?

JASS:

interface I
    integer array i
endinterface

struct HasFiveInts extends I
    integer array i[5]
endstruct

struct HasSevenHundredInts extends I
    integer array i[700]
endstruct


My structs have arrays but I need to get a method in the interface that can interact with those arrays. However, as vJASS DEMANDS that you state an array size, I'm screwed...


Obviously, this would be very inneficient for HasFiveInts:

JASS:

interface I
    integer array i[700]
endinterface

struct HasFiveInts extends I
endstruct

struct HasSevenHundredInts extends I
endstruct
 

Magentix

if (OP.statement == false) postCount++;
Reaction score
107
The thing I'm trying to achieve (in full) is this:

Working version:
JASS:

interface I
    method manipulateArray takes nothing returns nothing
endinterface

struct IS extends I
    method manipulateArray takes nothing returns nothing
        // Do nothing, just "sit" here
    endmethod
endstruct

struct HasFiveInts extends IS
    integer array i[5]

    method manipulateArray takes nothing returns nothing
        // Manipulate array i
    endmethod
endstruct

struct HasSevenHundredInts extends IS
    integer array i[700]

    method manipulateArray takes nothing returns nothing
        // Manipulate array i
    endmethod
endstruct

// Be able to call .manipulateArray on both structs


Desired version:
JASS:

interface I
    integer array i
    method manipulateArray takes nothing returns nothing
endinterface

struct IS extends I
    method manipulateArray takes nothing returns nothing
        // Manipulate array i
    endmethod
endstruct

struct HasFiveInts extends IS
    integer array i[5]
endstruct

struct HasSevenHundredInts extends IS
    integer array i[700]
endstruct

// Be able to call .manipulateArray on both structs
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top