I have a class that works something like this:
Code:class bleh { public: char *charArray; bleh(int size); private: }; bleh::bleh(int size) { charArray = new char[size]; }
then I realized that I wanted charArray to be 2d
however,
doesn't werkCode:class bleh { public: char *charArray; bleh(int size1, size2); private: }; bleh::bleh(int size1, int size2) { charArray = new char[size1][size2]; }
the only thing that I can get to work is somethint like:
Keeps yelling about either (based on small changes on my part):Code:class bleh { public: char charArray[100][100]; bleh(int size); private: }; bleh::bleh(int size) { }
A) doesn't like pointer
B) can't cast
C) doesn't like that a 2d array have variables for it's size
Any clues how it can be done?



LinkBack URL
About LinkBacks


