Class templates deriving from base class

Michael Mittner m.mittner at shebang.at
Thu Nov 26 12:47:07 PST 2009


Hi!

I'm trying to do something like this (in D1):

class Foo
{
    // ...
}

class Bar(T) : Foo
{
    // ...
}

alias Bar!(int) IntBar;
alias Bar!(Mars) MarsBar;

void main()
{
    Foo x = new MarsBar();
}

Common base class, one derived template class and a bunch of aliases that 
are then actually used in the code. But it seems like deriving a template 
class from a non-template one doesn't work. Is this supposed to work, am I 
doing something wrong or am I out of luck here?

-Mike


More information about the Digitalmars-d-learn mailing list