// ********** AdapterDemo.cpp ********** #include #include using namespace std; class TargetIF { public: virtual void newOperation() = 0; }; class Adaptee { public: void legacyOperation() {} }; class Adapter : public TargetIF { Adaptee* adaptee; public: Adapter() { adaptee = new Adaptee(); } void newOperation() { adaptee->legacyOperation(); } }; const int MAX = 1000; int main() { hrtime_t t1 = gethrtime(); for (int i=0; inewOperation(); } hrtime_t t2 = gethrtime(); cout << (t2-t1)/1000000 << " "; }