Here is some pseudo code of my setup:
class IMyClass { ... }; // pure virtual class
class CMyBaseClass { .... };
class CMyClass : public CMyBaseClass, public IMyClass { ... }
Then I have collection of CMyBaseClass*. I have custom RTTI that allows me to find out if a class implements given interface. So I can find which of the objects have IMyClass implementation. My problem is that I can’t cast it to that interface. I don’t want to use standard RTTI and dynamic cast.
I’m thinking in my custom RTTI to store some pointer diffs for casting between pair of classes, but I haven’t figure out implementation that makes me happy.
Any other solutions?
Well, if you insist in not using the language RTTI, you can use just like the old COM: make all your classes or interfaces derive from the following interface:
Now in your CMyClass:
Then in the user code: