3. 泛型 (信号槽) / enum Event { EVENT_ATMOSPHERE_CHANGE = 0 }; / class Country { public: int country_call_back(Event e) { printf("country->earthquake /n"); return 0; } }; / class Butterfly { public: typedef std::mem_fun1_t<int, Country, Event> Slot_Country; public: Butterfly(Country *country, Slot_Country slot) : country_(country), slot_country_(slot) {} public: void butterfly_fiap_wings() { printf("butterfly fiap wings /n"); Event e; e = EVENT_ATMOSPHERE_CHANGE; slot_country_(country_, e); } private: Country *country_; Slot_Country slot_country_; }; / int main(int argc, char* argv[]) { Country *country = new Country; Butterfly *butterfly = new Butterfly(country, std::mem_fun1(&Country::country_call_back)); butterfly->butterfly_fiap_wings(); return 0; }