www.digitalmars.com         C & C++   DMDScript  
Archives

D Programming
digitalmars.D
digitalmars.D.bugs
digitalmars.D.dtl
digitalmars.D.ide
digitalmars.D.dwt
digitalmars.D.announce
digitalmars.D.learn
digitalmars.D.debugger
D.gnu
D

C/C++ Programming
c++
c++.announce
c++.atl
c++.beta
c++.chat
c++.command-line
c++.dos
c++.dos.16-bits
c++.dos.32-bits
c++.idde
c++.mfc
c++.rtl
c++.stl
c++.stl.hp
c++.stl.port
c++.stl.sgi
c++.stlsoft
c++.windows
c++.windows.16-bits
c++.windows.32-bits
c++.wxwindows

digitalmars.empire
digitalmars.DMDScript
electronics


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=

 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