Is it necessary for an Object with an interface called IObject

Heromyth bitworld at qq.com
Thu Dec 29 17:27:20 PST 2011


I have noticed an old topic:
http://www.digitalmars.com/d/archives/digitalmars/D/Object_and_interface_compatibility_48235.html

The demo code can't be compiled whithout being modified. If we have an
interface named like IObject which the Object in module object is inherited
from, the "interface I" can be choiced to inherit the IObject. Then the demo
works.

As for interface-oriented programming, the custom interface maybe benefit from
the IObject.

In D, all the classes are inherited from the class Object by default. Maybe
it's a bad idea to have all the interfaces inherited from the IObject, for
example, what to do for a COM interface.


More information about the Digitalmars-d mailing list