"External interfaces" or "Interface maps"

Steven Schveighoffer schveiguy at yahoo.com
Fri Oct 17 12:26:45 PDT 2008


"Hxal" wrote
> =========================== External interfaces 
> ===============================
>
> The idea is to allow implementing an interface for a class, outside the
> class' definition. This is possible as I understand, because interfaces 
> are
> "fat" pointers -- they consist of an object reference and the interfaces'
> vtable for the particular class, which is separate from the class' vtable.
> Therefore it should be possible to create an interface vtable outside
> the module that declares the class.

I am not sure, but I don't think interfaces are 'fat' pointers.  I think 
they are simply pointers.

And the pointer points to a vtable in a class instance.  The vtable's has an 
element that is an offset to subtract from the pointer to get to the real 
object (which is a constant value).

So to make an external interface, you need to include the interface in the 
class data.  At least in order to fit into the implementation of the current 
system.

I could also be totally wrong ;)

-Steve 





More information about the Digitalmars-d mailing list