/*! \file Polygon.h * \brief A Regular Polygon has a number of sides of equal length */ #ifndef POLYGON_H_ #define POLYGON_H_ #include using namespace std; /*! * \class Polygon * \brief Definition of a container for a regular polygon * * The Polygon class holds a number of sides and the length of those sides. * All sides of a regular polygon have the same length. * Member functions set values of data members, retrieve those values, * get the perimeter or area, make comparisons to other Polygons, * and an overloaded stream insertion operator for outputting * the name of the shape. */ class Polygon { public: /*! * \fn Constructor * Requires: Number of sides, length of sides * Values default to 1. **************************************************************************/ Polygon(int = 1,double = 1.0); /*! * getSides - returns the number of sides * inspector **************************************************************************/ int getSides() const; /*! * getLength - returns the length * inspector **************************************************************************/ double getLength() const; /*! * getPerimeter - calculates and returns the perimeter * facilitator **************************************************************************/ double getPerimeter() const; /*! * getArea - calculates and returns the area * facilitator **************************************************************************/ double getArea() const; /*! * operator < - sorts the Polygon objects based on size * facilitator ***************************************************************************/ bool operator<(Polygon &right) const; /*! *operator == compares polygons *facilitatos ***************************************************************************/ bool operator==(Polygon &right) const; private: /*! * Number of sides attributed to the polygon */ int sides; /*! * Length of each side of the polygon */ double length; }; /*! * operator<< - overloaded operator for outputting Polygon's string name * facilitator **************************************************************************/ ostream &operator<<(ostream &, const Polygon &); #endif /* POLYGON_H_ */