/*! \file PolygonArrayList.h * \brief PolygonList subclass definition: Demonstrates inheritance hierarchy */ #ifndef WORDDATALIST_H #define WORDDATALIST_H #include #include #include "PolygonList.h" #include "Polygon.h" using namespace std; class PolygonArrayList : public PolygonList { /*! * \class PolygonArrayList * \brief PolygonList subclass that implements the list using a C++ array * * The Polygon array list is a subclass of the polygon list class, this subclass changes the * abstract class to utilize a single STL array container to house, manipulate, and display polygons. */ public: /*! * \fn Constructor * The default constructor initalizes the numShapes datamember to zero */ PolygonArrayList(); /*! * \fn ReadIntoList * This function takes a filename as a string and reads in up to * ten polygon attributes from the file into the array. */ void readIntoList(string filename); /*! \fn printIteratively * The printIteratively function uses the array indexes to print the contents of the * array. */ void printIteratively(); /*! * \fn * averageArea computes the total area of all objects in the array and divides by the total number. */ double averageArea(); private: /*! * \var TheShapes[10] TheShapes is the actual array in which the data is stored */ Polygon TheShapes[10]; /*! * \var numShapes numShapes is a value of how much data is already in the array. */ int numShapes; /*! * \fn * \param index index is the value to find the end of recursion * The recursePrint private function prints all of the data associated with a single * object then calls itself, passing the next object to print. When the last object is * printed, the recursion stops. */ void recursePrint(int index); }; #endif