December 30, 2011Is it necessary for an Object with an interface called IObject
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.
Copyright © 1999-2016 by the D Language Foundation