Array within a Class

Started by
0 comments, last by Prairie 23 years, 6 months ago
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
Advertisement
Not really enough information here to figure out exactly what you are doing but here we go:

    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