www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Template subclasses

reply Andrew <andrew.spott gmail.com> writes:
I'm curious how someone implements a templated class.  Basically, how do I do
this:

Class Foo(T) {
  T bar;
}

Class Fee:Foo {
  T fum;
}

Any ideas?

thanks

-Andrew
May 28 2009
parent Jarrett Billingsley <jarrett.billingsley gmail.com> writes:
On Thu, May 28, 2009 at 11:11 PM, Andrew <andrew.spott gmail.com> wrote:
 I'm curious how someone implements a templated class. =A0Basically, how d=
o I do this:
 Class Foo(T) {
 =A0T bar;
 }

 Class Fee:Foo {
 =A0T fum;
 }

 Any ideas?

 thanks

 -Andrew
You instantiate the base class. class Fee(T) : Foo!(T) { T fum; }
May 28 2009