November 08, 2003 Bug: Overloading, overriding and out parameters. | ||||
---|---|---|---|---|
| ||||
class A { void foo(out int x) { x = -3; } void foo(out char c) { c = 13; } } class B : A { override void foo(out int x) { } this() { char c; foo(c); } } A.foo(out char) isn't found in the B constructor. The compiler errors out with the message 'cast(int)(c) is not an lvalue'. It works fine if the out keyword isn't there. -- andy |
November 09, 2003 Re: Overloading, overriding and out parameters. | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andy Friesen | Look at Walter's answer to my message "BUG?: opIndex in opApply" from the 6th of November. It probably isn't a bug, but something to do with the reference nature of 'out'. Lars Ivar Igesund "Andy Friesen" <andy@ikagames.com> wrote in message news:bojt9e$b16$1@digitaldaemon.com... > class A > { > void foo(out int x) > { > x = -3; > } > > void foo(out char c) > { > c = 13; > } > } > > class B : A > { > override void foo(out int x) > { > } > > this() > { > char c; > foo(c); > } > } > > A.foo(out char) isn't found in the B constructor. > > The compiler errors out with the message 'cast(int)(c) is not an > lvalue'. It works fine if the out keyword isn't there. > > -- andy > |
Copyright © 1999-2021 by the D Language Foundation