// File: mGeoFacD.cc #include <fstream.h> #include <IOFactry.h> #include <PunktV.h> #include <Rechteck.h> #include <RchtckRn.h> #include <Dreieck.h> #include <Kreis.h> #include <ZGeoObj.h> int main() { MapOfPrototypes Prototypes; ifstream ITypes("mGeoFacD.in"); ifstream IData("mGeoFacD.dat"); // Collection gives data on cout: IOFactory Factory(&Prototypes, &ITypes, &cout); Prototypes["[Rechteck]"] = new Rechteck; Prototypes["[RechteckRund]"] = new RechteckRund; Prototypes["[Dreieck]"] = new Dreieck; Prototypes["[Kreis]"] = new Kreis; Prototypes["[ZGeoObj]"] = new ZGeoObj(&Factory); GeoObj *pz2 = Factory.CreateGeoObj(); if(pz2) { cout << pz2->GetTypeString() << " created." << endl; cout << "Now reading data ... "; IData >> (*pz2); cout << "finished." << endl; cout << "Flaeche: " << pz2->flaeche() << endl; Factory.CollectGeoObj(pz2); cout << "Pointer after collection is: " << hex << pz2 << endl; } }