Jason Winnebeck wrote:
I tried using enable_shared_from_this with virtual inheritance, just to see if it would work. I couldn't get it to work. The first barrier is that enable_shared_from_this is a templated class, and from what I understand is that two template instantiations of a class are two entirely different classes, so I didn't even try to use virtual on that.
Sorry, I completely missed that enable_shared_from_this was a template class. Yes in that case it won't work unless possibly you did something like this class TheBase : public enable_shared_from_this<TheBase> { }; class Base1 : virtual public TheBase { }; class Base2 : virtual public TheBase { }; class MyClass : public Base1, public Base2 { }; But then you may need dynamic_casts somewhere to get the actual interface pointer you required later so don't know if that will be possible. Thanks Russell