(In addition to the problems others have noted about failure to initialize member variables)
You're using multiple variables with the same name, presumably unintentionally.
In this member function
void setBufSize( size_t size )
{
bufferSize = size;
int* buffer = new int[bufferSize];
for (size_t i = 0; i < bufferSize; i++)
buffer[i] = 0;
}
buffer
is a local variable. You aren't using or updating the member variable with the same name.
Try a simple assignment buffer = new int[bufferSize];
instead of a variable declaration. Or even better, use a std::vector
instead.