views:

99

answers:

1

Say you have two assemblies (two dlls). The first contains a class called Base and the second contains a class called Derived which publicly inherits from Base.

When I use the tlb files to create C++ classes in Visual Studio 2005, I get Base and Derived classes, but one is not a subclass of the other. There doesn't seem to be any IS-A relationship. Is there a reason for this?

+2  A: 

I'm assuming here, that the two assemblies communicate one with the other via COM, if that is indeed the case then you are correct, there is no IS-A relationship in COM in regard to CLASS inheritance, only in regard to Interface inheritance.

If you were to define an interface IBase and IDerived which derives from IBase, then you would be able to cast IDerived to IBase on the same object which implements both.

Alex Shnayder
Or what if Derived just implemented IBase. Wouldn't that be good enough?
criddell
Yes it would. Since in COM there there are only interfaces, it does not matter what is the object inheritance tree, as long as your objects implement those interfaces that you need.
Alex Shnayder