I don't know (if it's even possible) how to allocate an array from a class that has constructor with parameters using another constructor with parameters. For example (I'll write just what's actually relevant. Uhm, I doubt the template is, but still):
template <typename T>
class C1 {
T *array;
public:
C1 (int n) {
array = new T [n];
};
};
class C2 {
int length;
int lengthArrayC1;
C1<T> *array;
public:
C2 (int x, int y) {
length = x;
lengthArrayC1 = y;
array = //and here's where I'm lost
};
};
I tried writing something like this in many ways:
array = new [length] C1<T> (lengthArrayC1);
but none worked.