C++ class for constructing a polygon