Template Inheritance

BLM blm768 at gmail.com
Tue Feb 21 16:13:17 PST 2012


That last one looks a lot better than my solution. It's certainly a lot clearer.

One problem I discovered with using templates was that I ended up needing virtual
functions, which means that I had to convert the template functions to mixins and
just instantiate them for each type (at least there were only two types to
handle!) in the base class. The problem I've got now is that if I create versions
of get() that take different types in subclasses, I lose access to the
superclass's overload set. If I try to use "alias Base.get get", DMD complains
that the alias and the functions conflict. It looks like I can override existing
overloads but not create new ones. I guess I might have to put a hold on the
project until the language gets modified (assuming that actually happens). How
would I go about filing an enhancement request?


More information about the Digitalmars-d-learn mailing list