December 02, 2002 bug in template subclasses | ||||
---|---|---|---|---|
| ||||
Hi, The following code doesn't compile. template A(T) { public interface I { public T i(); } } class B : instance A(int).I { public int i() { return 42; } } int main() { B b = new B(); instance A(int).I i = b; printf("B.i -> %d\r\n", b.i()); printf("I.i -> %d\r\n", i.i()); return 0; } The inheritance declaration of B doesn't accept a anonymous template instance, but accepts a qualified one. Best regards, Daniel Yokomiso. "Alcohol & calculus don't mix. Never drink and derive." |
December 04, 2002 Re: bug in template subclasses | ||||
---|---|---|---|---|
| ||||
Posted in reply to Daniel Yokomiso | Ok, I see what's going wrong. Thanks, -Walter "Daniel Yokomiso" <daniel_yokomiso@yahoo.com.br> wrote in message news:asgbf3$2uov$1@digitaldaemon.com... > Hi, > > The following code doesn't compile. > > > template A(T) { > public interface I { > public T i(); > } > } > class B : instance A(int).I { > public int i() { > return 42; > } > } > int main() { > B b = new B(); > instance A(int).I i = b; > printf("B.i -> %d\r\n", b.i()); > printf("I.i -> %d\r\n", i.i()); > return 0; > } > > > The inheritance declaration of B doesn't accept a anonymous template > instance, but accepts a qualified one. > > Best regards, > Daniel Yokomiso. > > "Alcohol & calculus don't mix. Never drink and derive." > > |
Copyright © 1999-2021 by the D Language Foundation