August 05, 2004 Calling through an interface invokes the wrong method | ||||
---|---|---|---|---|
| ||||
Calling through an interface invokes the wrong method: interface IOne { void one (); } interface ITwo { void two (); } interface IThree : IOne, ITwo { void three (); } class Three : IThree { void one () { printf ("one\n"); } void two () { printf ("two\n"); } void three () { printf ("three\n"); } } void main() { IThree three = new Three; three.one(); three.two(); three.three(); } print the following: one one three This clearly makes interfaces unusable at a rather fundamental level. Would very much appreciate a fix asap. |
August 08, 2004 Re: Calling through an interface invokes the wrong method | ||||
---|---|---|---|---|
| ||||
Posted in reply to van eeshan | By the way: switching the order of the IThree declaration to this: interface IThree : ITwo, IOne { void three (); } produces this (incorrect) output instead: two two three I suppose if there's honor amongst thieves then there should be symmetry within bugs. Can you perhaps give some indication when this might be resolved please? "van eeshan" <vanee@hotmail.net> wrote in message news:ces67k$rgj$1@digitaldaemon.com... > Calling through an interface invokes the wrong method: > > interface IOne > { > void one (); > } > > interface ITwo > { > void two (); > } > > interface IThree : IOne, ITwo > { > void three (); > } > > class Three : IThree > { > void one () > { > printf ("one\n"); > } > > void two () > { > printf ("two\n"); > } > > void three () > { > printf ("three\n"); > } > } > > > void main() > { > IThree three = new Three; > > three.one(); > three.two(); > three.three(); > } > > print the following: > > one > one > three > > This clearly makes interfaces unusable at a rather fundamental level. Would > very much appreciate a fix asap. > > |
Copyright © 1999-2021 by the D Language Foundation