fix struct API with an interface

John Colvin john.loughran.colvin at gmail.com
Thu Mar 6 05:35:11 PST 2014


On Thursday, 6 March 2014 at 13:26:27 UTC, Flamaros wrote:
> I add directx 9 support on DQuick and as some of renderer 
> objects are declared as struct, it seems it can make them 
> derives from an interface.
>
> Need I use final class instead to avoid virtual methods?
>
> PS: I am not planning to support run-time switch between OpenGL 
> and directX renderers.

I'm not sure I understand the question, but here's some facts 
that might help:

struct methods are never virtual.
final class methods are never virtual.
structs do not support inheritance.

Is the indirection caused by using an interface+class going to be 
a performance problem?


More information about the Digitalmars-d-learn mailing list