Structs implementing interfaces in D1
BCS
none at anon.com
Mon Feb 9 21:24:53 PST 2009
Hello Tom,
> 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.
>
struct S { int i; int j; int k; int n; }
S[5] sArr;
ca I make an inerface out of sArr[2] ?
More information about the Digitalmars-d
mailing list