class A { public: void foo(); }Here is how to wrap a new method of a different class around calls to the A class's foo method:
class B { private: A* a; public: B(A* a) { this->a = a; } void pre(); /* function that gets called prior to A::foo */ void post(); /* function that gets called after A::foo */ void foo(); /* To use the wrapper class,call B::foo instead of A::foo */ { pre(); a->foo(); post(); } }
Back to Research Projects |
This page has the following hit count:
|