Hi guys,
Having a little difficulty with an exercise from a book that I am working through. Currently looking at classes using a very simple graphics library: circles, polygons, lines, etc.
An example they have used is a Polygon class. You simply create as Polygon poly. And then call a member function to add points to the object to create the shape.
The exercise is to create a similar class that passes the points to the constructor to ensure that there are more than 2 points, ie, to ensure it fits with geometric rules about what a polygon is. My question is how do I check an arbitrary number of points within a constructor?
Obviously, I know how to pass a set number of arguments, it would simply look as such:
Code:
poly::poly(Point a, Point b, Point c)
{
//code
}
Any help is appreciated.
Thanks