class RefTest{public:RefTest():var0(array[0]),var1(array[1]),var2(array[2]),var3(array[3]),var4(array[4]),var5(array[5]),var6(array[6]),var7(array[7]),var8(array[8]),var9(array[9]), {} private:int array[10];int &var0;int &var1;int &var2;int &var3;int &var4;int &var5;int &var6;int &var7;int &var8;int &var9;};
C++ (Qt)class RefTest{public: enum Var {var_0 = 0, var_1, ...., var_count}public:RefTest() {} private:int array[var_count];};............array [var_1] = .......
.....var0=var1+var2;....
.....array[var_0]=array[var_1]+array[var_2];....
int* RegTest::getValues() {return array;}
C++ (Qt)#pragma pack(push, 4)class RefTest { public: union { int mArray[10]; struct { int mSpeed; // var0 int mAccel; // var1 int mTime; ... }; };};#pragma pack(pop)
C++ (Qt)mSpeed += mAccel * mTime;
C++ (Qt)union { int mArray[10]; struct { char mFlag; int mData; };};
array[var_0]=array[var_1]+array[var_2];
struct YouArray { int& var_0 () {return array [0];} int& var_1 () {return array [1];}private: int array_ [10];}......arr.var_0 () = arr.var_1 () + arr.var_2 ();
C++ (Qt)union { MyClass mA;};