Array within a Class
I have an array in a class. I want to give the array a depth dependant on a variable passed to the constructor. I''ve tried "new" and all sorts of other things and nothing is working. If anyone can guide me in the right direction, or even suggest an alternative way to do it, it would be greatly appreciated.
Thanks;
Prairie
Not really enough information here to figure out exactly what you are doing but here we go:
Edited by - acraig on October 3, 2000 12:44:36 PM
class IHaveAnArray{ public: IHaveAnArray(int arraySize) { myInternalArray = new int[arraySize]; // check error } ~IHaveAnArray() { delete[] myInternalArray; } private: int *myInternalArray;};
Edited by - acraig on October 3, 2000 12:44:36 PM
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement