I thought that was expected behavior when you didn't declare factory virtual in B, since the virtual jump table in A is overriding B's function table.
When I tried this, making B's factory virtual caused B's factory to get called instead of A's.
On Sunday 10 February 2008 09:55, Paul J R wrote:I think you might need to call factory like "this->factory()"
> class A {
> public:
> A() {}
> ~A() {}
> virtual void worker() {
> std::cout << "I am A worker" << std::endl;
> }
> virtual A *factory() {
> std::cout << "Factory for A class called" << std::endl;
> return new A;
> }
> virtual void operator()() {
> std::cout << "Calling A operator()" << std::endl;
> worker();
> }
> void threadcontroller() {
> boost::thread_group thre;
> for(;;) {
> std::cout << "I am in the A.threadcontroller()
> method" << std::endl;
> A *mea = factory();
--
> the next 2 are from after the thread_group.create_thread() call. Once
> its in the thread it seems to revert to class A's methods.
>
> Now, i know if i overload the threadcontroller class in B it'd solve all
> my problems, but the real threadcontroller method is alot more complex
> and class A has about 6 sub classes so replicating the threadcontroller
> in each of the classes would be a little tedious.
Frank
_______________________________________________
Boost-users mailing list
Boost-users@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users