Inherited function call from Base initializer :)
I ran into an interesting problem trying to create a default thread handler. Take a look at the code, because it's easier to explain that way :). I want the new Foo initializer to call the foo instance handler, not the Bar handler. Any ideas? Thanks >;-)
#include <iostream>
class Bar;
void callback( Bar *);
class Bar {
public:
Bar( void) {
callback( this);
}
virtual void instance( void) {
std::cout << "Bar::instance was called" << std::endl;
}
};
class Foo : public Bar {
void instance( void) {
std::cout << "Foo:instance was called" << std::endl;
}
};
void callback( Bar *t) {
t->instance();
}
int main( void) {
new Foo();
return 0;
}
