#ifndef GRANDCHILD_H #define GRANDCHILD_H //The 3 "motion" classes tell the grandchild how to move. #include "manual.h" #include "randomly.h" #include "immobile.h" //The 3 "position" classes tell the grandchild its position in the food chain. #include "position.h" /* MOTION must be a class derived from class wabbit, implementing the decide member function (and maybe the punish member function). POSITION must be a class derived from class wabbit, implementing the hungry and bitter member functions. The constructor of the grandchild calls the constructors for the grandparent, the mother, and the father. */ template class grandchild: public MOTION, public POSITION { public: grandchild(const terminal& init_t, unsigned init_x, unsigned init_y): wabbit {init_t, init_x, init_y, C}, MOTION {init_t, init_x, init_y, C}, POSITION {init_t, init_x, init_y, C} { } }; /* The template class grandchild lets us mix and match various combinations of motions (mothers) and positions (fathers). With 3 motions and 3 positions to chose from, we could easily make 3 x 3 = 9 grandchild classes instead of just the 4 below. Dangerous grandchildren have uppercase names ('W', 'M'). */ using rabbit = grandchild; using wolf = grandchild; using boulder = grandchild; using landmine = grandchild; //etc. #endif