Is the template method non virtual?

baleog maccarka at yahoo.com
Wed Jul 16 13:50:10 PDT 2008


Here is the test code:
--
class A {
  bool f1() { return false; }
  bool f2(T)() { return false; }  
}

class B : A {
  bool f1() { return true; }
  bool f2(T)() { return true; }
}

void main()
{  
  A a = new B;
  assert(a.f1()); // OK
  assert(a.f2!(int)()); // assert error
}
--
Is it a regular behaviour? And what should I do to implement a virtual templated method?

thanks
p.s. dmd-2.0.16


More information about the Digitalmars-d-learn mailing list