class AdapteeOne { public: int Responce1() { cout<<"Respose from One."<<endl; return 1; } }; class AdapteeTwo { public: int Responce2() { cout<<"Respose from Two."<<endl; return 2; } }; class Adapter { public: int (AdapteeOne::*fnptrOne)(void); int (AdapteeTwo::*fnptrTwo)(void); Adapter(AdapteeOne* adone) { fnptrOne = &(AdapteeOne::Responce1); this->*fnptrOne(); } Adapter(AdapteeTwo adtwo) { fnptrTwo = &(AdapteeTwo::Responce2); } }; void main() { Adapter* adpter = new Adapter(new AdapteeOne()); /////Place to call function pointers of Adapter class P; }
execute
fnptrOne
fnptrTwo
Responce1
Responce2
static
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)