I remember reading somewhere that it was possible to have a class with an array whose size was determined at instantiation time. So that the size of the internal array size would be constant for the life of the object but that the array size was gotten from an input parameter and used in a constructor initalizer. Something like the very broken...
Dispite the errors above, is what I'm trying to accomplish possible?Code:#include <iostream> using namespace std; class oo{ public: int ii[]; oo(int n): ii(n){}; //Trying to setup array size here }; int main(int argc, char* argv[]){ oo xx(10); for (int i = 0; i < 10; ++i){ xx.ii[i] = i; cout << xx.ii[i] << endl; } }