Template Inheritance

Timon Gehr timon.gehr at gmx.ch
Sat Feb 18 19:00:17 PST 2012


On 02/19/2012 01:55 AM, %u wrote:
> I've been working on porting an old D library to D2, and I'm running into a
> nasty issue with templates and inheritance. I've got a base class like this:
>
> class Reader {
>      void get(T)(ref T[] buffer);
> }
>
> and a subclass like this:
>
> class SubReader {
>      void get()(SomeClass param);
> }
>
> The problem is that by creating a new form of the template in the subclass, I
> made the base class's version invisible. If I try to use "alias Reader.get
> get" like I would do for functions, the compiler complains that the symbols
> clash (no musical puns intended).

That is a bug.

> Does anyone know how to get this to work?

There seems to be no perfect way in the current implementation.


More information about the Digitalmars-d-learn mailing list