I have two constructors: an explicit default ctor and a value ctor that will be used to create a histogram.
Whenever I try to compile my value ctor -- specifically focusing on the putSamples[] -- I get an error reading "uninitialized member ‘SamplingClass::putSamples’ with ‘const’ type ‘const int [0]’ [-fpermissive]
SamplingClass::SamplingClass()"
In this case, is there way to initialize the array in the value ctor, or is it necessary to define it outside of the ctor? Any help is appreciated.
You need to specify the size of the array, and it has to be a compile time constant. You probably also don't want to use const because it makes it impossible to copy values to it.
int putSamples[MAX_DATA_SET_SIZE];
This line ...
putSamples[99] = {0};
... does not change the size of the array. In fact, it is impossible to change the size of an array after it has been created. What this line actually does is to set the array element at index 99 to zero.
You can also not copy arrays using the = operator. Instead you would have to use a loop or a function such as std::fill.
A better choice might be to use std::vector instead of arrays. std::vector can easily be resized and you can easily copy them using the = operator. http://www.cplusplus.com/reference/vector/vector/