c++ - Constant array size in class -
I have a problem in creating an array in the constructor See my code:
class Foo {private: const int size; Double * tab; Public: Foo (Int.); }; Foo :: foo (int s): size (s) {tab = new double [size] [size]; }
The creator can not create a new array because the size of the array is not a constant value ... what is wrong in it? I'm sure it's really easy.
P.S. I apologize for my bad english.
tab
indicator and assign you a different dimension in a loop separately Will happen.
square foo {private: const int size; Double ** tab; Public: Foo (Int.); ~ Foo (); }; Foo :: foo (int s): size (s) {tab = new double * [size]; For (int i = 0; i
Comments
Post a Comment