//: C09:TrashPrototypeInit.cpp {O} // From Thinking in C++, 2nd Edition // Available at http://www.BruceEckel.com // (c) Bruce Eckel 2000 // Copyright notice in Copyright.txt // Performs initialization of all the prototypes. // Create a different version of this file to // make different kinds of Trash. #include "Trash.h" #include "Aluminum.h" #include "Paper.h" #include "Glass.h" #include "Cardboard.h" // Allocate the static member object: std::vector Trash::prototypes; class TrashPrototypeInit { Aluminum a; Paper p; Glass g; Cardboard c; TrashPrototypeInit() { Trash::prototypes.push_back(&a); Trash::prototypes.push_back(&p); Trash::prototypes.push_back(&g); Trash::prototypes.push_back(&c); } static TrashPrototypeInit singleton; }; TrashPrototypeInit TrashPrototypeInit::singleton; ///:~