Help: How could I deal with this?
-
as follows, what should I do? thanks:) class A { public: void f(void (*g)(int), int i) const { (*g)(i); } protected: //must be virtual, some one inherit from it virtual void g(int i) const { ; } }; class B { public: B() { pa = new A; } ~B() { delete pa; } //my problem is here: the first argument pa->g :( void fb() const { pa->f( (pa->g), 0); } private: A* pa; };
-
as follows, what should I do? thanks:) class A { public: void f(void (*g)(int), int i) const { (*g)(i); } protected: //must be virtual, some one inherit from it virtual void g(int i) const { ; } }; class B { public: B() { pa = new A; } ~B() { delete pa; } //my problem is here: the first argument pa->g :( void fb() const { pa->f( (pa->g), 0); } private: A* pa; };
-
as follows, what should I do? thanks:) class A { public: void f(void (*g)(int), int i) const { (*g)(i); } protected: //must be virtual, some one inherit from it virtual void g(int i) const { ; } }; class B { public: B() { pa = new A; } ~B() { delete pa; } //my problem is here: the first argument pa->g :( void fb() const { pa->f( (pa->g), 0); } private: A* pa; };
i dont think its possible to create a pointer to the member function and use it.
I'll write a suicide note on a hundred dollar bill - Dire Straits