Diego Bernini wrote:
see these lines:
boost::shared_ptr<Executor> executor(&(createExecutor(subclass,name))); if(!executor) { throw LoadingClassException("createExecutor function of\""+subclass+"\" return null."); } //executor points to an object of class ExecDebugger that IS A Executor //(it's a plugin loaded at run time via Qt)
boost::shared_ptr<Nameable> a=executor; boost::shared_ptr<Executor> sp;
sp=boost::dynamic_pointer_cast<Executor>(a);
Please post a minimal complete example we could compile? I must confess I don't quite understand the class hierarchy you have in mind. I also don't understand the first line. If the return type of createExecutor() is Executor*, why are you taking the address of the returned value with & ? Wouldn't that produce an Executor**? But if the return type of createExecutor() is Executor, aren't you taking the address of a temporary object that will be destroyed?