How i write dynamic array in class?

How i write dynamic array in class?

class Garage {

int*Parks=new int [10];
}


int*Parks=new int [10]; // the problem it's gave me wring in the delectation
here's an example:

1
2
3
4
5
6
7
8
9
class Array
{
public:
Array(const int size)
{
array = new int[size];
}
private:
int* array;


EDIT: Oh and also don't forget to write a destructor to deallocate the memory.
Last edited on
OK thanks a lot :)
Topic archived. No new replies allowed.