vector <point> polygon;
this is my prototype for a class called polygon:polyg & operator=(polyg& pg);//5
here is the directions:
make An overloaded operator = with a reference parameter of type polyg and a return type of reference polyg.
First make sure its not the same object because if it is then nothing to do. If a different object then
clear the polygon and add the points of the passed polygon to it.
polyg & polyg::operator=(polyg& pg);//5
{
polyg pgtemp;
if(pgtemp.polygon[i] == pg.polygon[i])
{
break;
}
for (int i=0,i<polygon.size(),i++)
{
pg.ploygon.erase(i);
pg.polygon.push_back(polygon.pg[i]);
}
}
does that work? also i keep gettin a compile error saying:binary '=' : no operator found which takes a right-hand operand of type 'int' (or there is no acceptable conversion)
polyg &polyg::operator =(polyg &)' : member function redeclaration not allowed
'{' : missing function header old-style formal list?)