fix struct API with an interface

Xavier Bigand flamaros.xavier at gmail.com
Thu Mar 6 13:50:51 PST 2014


Le 06/03/2014 19:08, Dicebot a écrit :
> On Thursday, 6 March 2014 at 14:28:13 UTC, Flamaros wrote:
>> Ok, it's like I though final class and struct are equivalent when
>> calling a method (except the pointer deference, but it's minor I think).
>>
>> I don't think there is a real performance problem for us, it's more
>> about to learn how to have a clean design.
>
> They are equivalent when calling directly through class instance. When
> called though interface pointer, final class still results in vtable
> dispatch (because type system can't know stored class is final)
>
> But if you need to inherit from existing interface it is best thing you
> have anyway.

In my case as I don't build openGL and DirectX module in the same 
binary, it can share the same modules and classes names. So I'll use 
them through the class instead of the interface.

Thank you for your explanations.



More information about the Digitalmars-d-learn mailing list