///////////////////////////////////////////////////////////////// // implementation.cpp - provides implementation for // // implementation layer classes // // and for static members of interface // // // // Jim Fawcett, CSE687 - Object Oriented Design, Spring 2002 // ///////////////////////////////////////////////////////////////// #pragma warning(disable : 4786) #include #include "implementation.h" //----< virtual function displays class identity >------------- void test1::announcer() { std::cout << "\n object of class " << id(); } //----< virtual function displays class identity >------------- void test2::announcer() { std::cout << "\n object of class " << id(); } //----< register objects of this module for client >----------- void tester::registerObjects(objFactory &factory) { factory.reg(test1::id(),test1::create); factory.reg(test2::id(),test2::create); } //----< let client identify the object needed >---------------- std::string tester::type(int n) { switch(n) { case 1 : return "test1"; case 2 : return "test2"; default : throw "unknown class in tester::ids()"; } return "unknown"; }