D.gnu - Implementation of Interfaces
- Ingmar Schuster (6/6) Dec 08 2005 Hi,
- David Friedman (11/19) Dec 10 2005 Basically, it's multiple inheritance.
Hi, A quick-and-easy question on the implementation of interfaces in gdc: hows it done, with multiple inheritance, interface dispatch tables like in gcj or some third method? Greetings Ingmar Schuster
Dec 08 2005
Ingmar Schuster wrote:Hi, A quick-and-easy question on the implementation of interfaces in gdc: hows it done, with multiple inheritance, interface dispatch tables like in gcj or some third method? Greetings Ingmar SchusterBasically, it's multiple inheritance. When a class is declared to implement an interface, a field is added to the class that points to a virtual method table for that interface. If an interface is reimplemented in a descendant class, another field is added instead of using the one from the ancestor class. Both fields will have the same value. Except for COM interfaces, the first entry of the interface virtual method table points to some information that can be used to cast the interface reference back to its object reference. David
Dec 10 2005