#include using namespace std; typedef const char * String; enum Month{JAN=1,FEB,MAC,APR,MAY,JUN,JUL,AUG,SEP,OCT,NOV,DEC}; class AbstractProduct{ public: virtual String ShipFrom()=0; }; class ProductA:public AbstractProduct{ public: String ShipFrom(){ return " from South Africa"; } }; class ProductB:public AbstractProduct{ public: String ShipFrom(){ return "from Spain"; } }; //class DefaultProduct:public AbstractProduct{ //public: // String ShipFrom(){ // return "not available"; // } //}; class AbstractCreator { public: virtual AbstractProduct* FactoryMethod(int month)=0; }; class Creator:public AbstractCreator{ public: AbstractProduct* FactoryMethod(int month){ switch(month) { case JAN: case FEB: case DEC: return new ProductB(); case APR: case MAY: case JUN: case JUL: case AUG: case SEP: case OCT: case NOV: return new ProductA(); default : return 0; //return new DefaultProduct(); } } }; int main(){ AbstractCreator *c = new Creator(); for (int m=JAN;m<=DEC;m++){ AbstractProduct *product = c->FactoryMethod(m); if (product){ cout<<"Avocados "<ShipFrom()<