Originally Posted by
dwks
The ReferenceCounter is using const void* pointers and uses typeid to remember the type of the original object added to it. I don't really think it can be improved that much, unless there's a way to detect whether a class is multiply-inherited or not.
Why didn't you go for say, std::tr1::shared_ptr instead of ReferenceCounter?
Originally Posted by
dwks
Maybe I've been using too much Java lately, because it would be a perfect place to use Java interfaces.
A class without data members defines a pure interface, so the C++ near-equivalent to a Java interface is an abstract base class without data members. That said, I think you knew this already
EDIT:
Oh, looking at your code again, maybe the appropriate solution in this case is to use virtual inheritance:
Code:
class Branch1 : virtual public Base {};
class Branch2 : virtual public Base {};