Assigning Interface to Object

Christopher Nicholson-Sauls ibisbasenji at
Wed Jan 19 23:41:30 PST 2011

On 01/20/11 01:01, Mandeep Singh Brar wrote:
> "This would be easily resolved if interfaces were known to be Objects. "
> But shouldnt this be the case, because there would be nothing called as an
> Interface which can be pointed to; it would be an Object which is implementing an
> interface which is being pointed to. So shouldnt Interfaces be Objects too.
> Otherwise, wouldnt it defeat the purpose of having Object as the base class for
> everything.
> Thanks
> Mandeep

There are actually Interfaces which don't necessarily imply inheritance
from Object.  The canonical example being IUnknown and it's own
descendants, used for interacting with COM libraries.  Another example
-- as I understand the implementation at least -- are 'extern(C++)'
interfaces, which are really API declarations for C++ classes.

That said, these are special cases, and I would expect the assertion
that interface <- Object to be true in all other cases.

-- Chris N-S

More information about the Digitalmars-d-learn mailing list