Command Design Pattern C++

Command Design Pattern

// Parameter should contain in type T // if need to use different signature for function pointer use function and bind from Boost. // use union concept and make this can work with function pointer vs class member function pointer.
template <typename T> class command { public: // class member function pointer typedef void(T::*Action)(); Command(T *object=0, Action method=0){ m_object = object; m_method = method; } void execute() { (m_object->*m_method)(); }
// now decide as per your domain //is this copyable or movable or none
private: T *m_object; Action m_method; }

1 comment:

  1. Casino Player Reviews: The best casino bonus offers
    What's the best casino bonus and offers? ➤ We 여수 출장샵 review 시흥 출장샵 the ⭐ best Casino Player bonuses at 울산광역 출장샵 JTM Hub and tell you 김해 출장안마 the top 광양 출장샵 10 casino bonus offers.

    ReplyDelete

would you like it. :)