A
ankurdave
Is it possible to declare a class member variable in the constructor?
For example,
class SomeClass
{
public:
SomeClass()
{ int SomeArray[10]; }
}
In this example, is it possible to make SomeArray[] a member variable
without putting the declaration like this:
class SomeClass
{
public:
SomeClass();
private:
int SomeArray[10];
}
The reason I am asking this is that I would like to create an array
whose size is determined by the parameters passed into the constructor.
For example,
class SomeClass
{
public:
SomeClass()
{ int SomeArray[10]; }
}
In this example, is it possible to make SomeArray[] a member variable
without putting the declaration like this:
class SomeClass
{
public:
SomeClass();
private:
int SomeArray[10];
}
The reason I am asking this is that I would like to create an array
whose size is determined by the parameters passed into the constructor.