Templated member functions in interfaces

Jarrett Billingsley kb3ctd2 at yahoo.com
Wed Apr 18 17:49:04 PDT 2007


"Jason House" <jason.james.house at gmail.com> wrote in message 
news:f06cse$h1b$1 at digitalmars.com...
> Here's a simplified version of the code I'm trying to get working. 
> Honestly, I didn't expect it to work, but I was hoping...
>
> Is there any hope for this style of usage to work?  I'm pleasantly 
> surprised by it compiling at all.  In the full implementation, the 
> templated calls to X occur after a few more layers of obfuscation.  If the 
> below code really does compile and link correctly, I can give a more 
> complex example.

It might compile, but it might not do what you expect it to.  Templated 
member functions (and interface methods) are never virtual and therefore 
cannot participate in polymorphism.  :\ 




More information about the Digitalmars-d-learn mailing list