Note that this is also a good interview question, if you're so inclined. I came up with this with a lot of help from
#include <iostream> class Base { protected: Base(void) { std::cout << __PRETTY_FUNCTION__ << std::endl; } virtual ~Base() { std::cout << __PRETTY_FUNCTION__ << std::endl; } public: void method(const char *string) { std::cout << __PRETTY_FUNCTION__ << std::endl; methodWrapper(string); std::cout << __PRETTY_FUNCTION__ << std::endl; } private: virtual void methodWrapper(const char *) = 0; }; class IBase : public Base { protected: IBase(void) { std::cout << __PRETTY_FUNCTION__ << std::endl; } virtual ~IBase() { std::cout << __PRETTY_FUNCTION__ << std::endl; } private: void methodWrapper(const char *string) { std::cout << __PRETTY_FUNCTION__ << std::endl; method(string); std::cout << __PRETTY_FUNCTION__ << std::endl; } virtual void method(const char *) = 0; }; class MyClass : public IBase { public: MyClass(void) { std::cout << __PRETTY_FUNCTION__ << std::endl; } ~MyClass() { std::cout << __PRETTY_FUNCTION__ << std::endl; } private: void method(const char *string) { std::cout << string << std::endl; } }; void hello(Base *base) { std::cout << __PRETTY_FUNCTION__ << std::endl; base->method("Hello, world!"); std::cout << __PRETTY_FUNCTION__ << std::endl; } int main(void) { MyClass test; hello(&test); return (0); }