Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class A
- {
- public:
- A() : value(false) {}
- bool get() const
- {
- return value;
- }
- protected:
- bool value;
- };
- class B : public A
- {
- public:
- void set()
- {
- value = true;
- }
- };
- B* b = new B;
- std::shared_ptr<A> a(b);
- auto func = std::bind(&B::set, *b);
- std::cout << a->get() << std::endl;
- func();
- std::cout << a->get() << std::endl;
- auto func = std::bind(&B::set, std::ref(*b));
- auto func = std::bind(&B::set, b);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement