Getting vtable for inherited Interface instance

Kapps opantm2+spam at gmail.com
Tue Aug 20 22:38:58 PDT 2013


I'm trying to implement a runtime reflection module, and am 
having some issues with figuring out the function pointer to 
invoke an interface on a class that derives from the one that 
implements the interface.

For example, given the following code, we can call an interface 
function using a delegate with http://pastie.org/8255612 - but 
even with the derived instance passed in it will invoke Bar's 
implementation as we're using the function pointer for Bar's 
implementation. I figured typeid(DerivedBar).interfaces would 
return it's own Interface instance for DerivedBar, but it doesn't 
and instead Bar's has to be used. The ABI page doesn't seem to 
mention much about inheriting from a class that implements an 
interface and overrides it's functions. Is there a way for me to 
get the function pointer to the overridden version of foo?


More information about the Digitalmars-d-learn mailing list