Structs implementing interfaces in D1

Tom S h3r3tic at remove.mat.uni.torun.pl
Mon Feb 9 21:15:03 PST 2009


BCS wrote:
> Hello Tom,
> 
>> The concept is pretty simple. The mixin creates a vtable which points
>> to
>> a set of generated functions of the form { adjust the 'this' ptr; jump
>> to the real function; }. Finally, the "InterfaceName
>> asInterfaceName()"
>> functions generated inside the struct return pointers to the
>> corresponding vtables.
> 
> where is the vtable pointer placed?

In the struct instance. There will be one for each implemented 
interface, just as with class instances.


-- 
Tomasz Stachowiak
http://h3.team0xf.com/
h3/h3r3tic on #D freenode



More information about the Digitalmars-d mailing list