Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <boost/bind.hpp>
- #include <boost/function.hpp>
- #include <stdio.h>
- class Base
- {
- public:
- virtual void foo()
- {
- printf("Base::foo\n");
- }
- };
- class Derived : public Base
- {
- public:
- virtual void foo()
- {
- printf("Derived::foo\n");
- }
- };
- int main()
- {
- Base* pb = new Derived;
- boost::function<void()> f = boost::bind(&Base::foo, pb);
- f(); // prints "Derived::foo"
- }
Add Comment
Please, Sign In to add comment