Template Inheritance

Jonathan M Davis jmdavisProg at gmx.com
Sat Feb 18 17:24:51 PST 2012


On Sunday, February 19, 2012 01:17:42 %u wrote:
> Thanks! I guess I'll just have to live with redefining the functions, do
> some sort of interface/mixin thing, or change the class interface. It makes
> sense that template functions aren't virtual (how are you supposed to deal
> with vtables?), but I wish that at least an alias declaration could work.
> Maybe if there were some way to alias the base template and then modify
> it...
> 
> Templates inheriting from templates would be a very interesting way to
> accomplish that, but it would be a very strange system...

aliases only work with actual, concrete functions. So, you could alias an 
specific instantiation of a templated function, but not the templated function 
as a whole. e.g.

alias get!int getInt;

works, but

alias get getVal;

doesn't.

- Jonathan M Davis


More information about the Digitalmars-d-learn mailing list