This is the third possibility. You create instances of a class and define their behavior on a per instance basis. Depending on the pointer of object you pass to Connect() the same method gets called on different objects leading to different behavior. You would pass Connect() the method address and a pointer to the object: button->OnLeftClick.Connect( &BazClass::Baz, &baz1 );
| 30 | // You would pass Connect() the method address and a pointer to the object: |
| 31 | // button->OnLeftClick.Connect( &BazClass::Baz, &baz1 ); |
| 32 | class BazClass { |
| 33 | public: |
| 34 | BazClass( int m_type ); |
| 35 | void Baz(); |
| 36 | |
| 37 | int m_type; |
| 38 | }; |
| 39 | |
| 40 | // In this example we tell the object how it is to behave by setting |
| 41 | // it's type in the constructor. |