Reputation: 1952
I am fairly new to C++ and am wondering if I am allowed to do the following:
class oFoo{
...
}
class Foo{
int x;
oFoo* oArray[x];
public:
Foo(int xVal);
Foo~();
}
Am I allowed to use x as the bound for the array of pointers to class oFoo??
Upvotes: 0
Views: 56
Reputation: 73443
No, only compile time constants are allowed. If you require dynamic array take a look at std::vector.
Upvotes: 3