I want to implement a pure virtual function of a shared lib and call it in a lib-function. This lib-function will be called in the constructor of the lib. The class which contains the pure virtual function is in an own namespace. It looks like this:
//shared lib class:
namespace A{
namespace B{
class SharedLibClass : public object{
public:
SharedLibClass(){init();}
protected:
virtual const object* func()const=0;
private:
void init(){const object* obj=func();}
}
}//namespace B
}//namespace A
//implementation class using the shared lib:
class B : public A::B::SharedLibClass
{
protected:
virtual void func(){return this;}
}
This are my classes. I can compile them without problems, but when I run it, Qt prints out the following error:
pure virtual method called
terminate called without an active exception
I could imagine the problem is, that the parent class calls the virtual function before it is initialised or something like that. How can I solve this problem?