www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - Delegates + Polymorphism

I think that this should be allowed:
class A {}
class B:A {}
struct C {
  void foo(A a) {}
}
void main() {
  C c;
  void delegate(B b) dl = &c.foo;
}

That is to say, that I think void delegate(A a) should be implicitly
castable to void delegate(B b) since all B's are also A's.  I can't
think of any reasons for this not to be.

John Demme
Jun 20 2005