Before this statement
this->vertex = new Vertex[source.capacity];
insert statement
delete [] this->vertex;
Also the operator must look the following way
Polygon &Polygon::operator=(const Polygon &source)
{
if ( this != &source )
{
this->capacity = source.capacity;
//...
}
return *this;
}