DanglingPointer
Programmer
How can I dynamically allocate a 2d array with parameters passed to a constructor?
I want to do this:
Thing::Thing(int num1, int num2)
{
ptr = new float[num1][num2];
}
But this isn't valid syntax. How would I go about this? Overloading the new operator?
I want to do this:
Thing::Thing(int num1, int num2)
{
ptr = new float[num1][num2];
}
But this isn't valid syntax. How would I go about this? Overloading the new operator?