I`m trying to implement something like this using C++11.
class Proto{
public:
virtual void fu();
};
class Impl: public Proto{
public:
void fu();
};
void Impl::fu(){
LOG_INFO("im fu");
}
class Inv{
public:
void useFu(void (Proto::*)());
};
void Inv::useFu(void (Proto::*fu)()){
//fu();
};
void main(){
Impl impl;
Inv inv;
//inv.useFu(impl.fu);
}
useFu(void (Proto::*)())
must be declared in this way because, fu()
uses some specific to Proto
functionality's
I have two places were things going wrong. First is fu()
call itself and second how to pass fu as parameter inv.useFu(impl.fu)
.
Aucun commentaire:
Enregistrer un commentaire