c++ initialize values static int with CLI array -
so have 2 arrays both 2 dimensional cli::arrays. what's right syntax initialize cli::array. tried in example below doesnt work.
//cords.h ref class cords { private: static array<int,2>^ xcord = gcnew array<int,2>(4,4); // [4][4] static array<int,2>^ ycord = gcnew array<int,2>(4,4); // [4][4] public: cords(); static int getx(void); static int gety(void); }; int cords::xcord[0][0] = 4234; //on these lines mistake int cords::ycord[0][0] = 2342; //on these lines mistake
so fixed problem static constructor , noticed supposed type [0,0] instead of [0][0]. i'm used normal c arrays.
//cords.h ref class cords { private: static array<int,2>^ xcord = gcnew array<int,2>(4,4); // [4][4] static array<int,2>^ ycord = gcnew array<int,2>(4,4); // [4][4] static cords() { //static constructor initialize values xcord[0,0] = 4234; // [0,0] instead of [0][0] ycord[0,0] = 2342; ... } public: cords(); static int getx(void); static int gety(void); };
Comments
Post a Comment