Invalid method called - reduced test case
Tom S
h3r3tic at remove.mat.uni.torun.pl
Mon Mar 6 11:44:05 PST 2006
Thomas Kuehne wrote:
> Your test case seems to be broken:
>
> === a.d ===
> private import b;
>
> class Foo : Bar {
> void foo() {
> assert(false); // this should never be called !
> }
> }
>
> === b.d ===
> class Bar {
> private import a;
>
> void bar() {
> printf("Bar.bar()\n");
> }
> }
>
> === main.d ===
> private import a;
>
> void main() {
> (new Foo()).bar();
> }
>
>
> You call Foo.bar in main - that's exactly the function you didn't expect
> to execute.
Wrong.
I tell it to call Foo.bar but Foo.foo gets called (the function that
contains the assert) :)
The order in which these modules are passed to the compiler is important.
--
-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GCS/M d-pu s+: a-->----- C+++$>++++ UL P+ L+ E--- W++ N++ o? K? w++ !O
!M V? PS- PE- Y PGP t 5 X? R tv-- b DI- D+ G e>+++ h>++ !r !y
------END GEEK CODE BLOCK------
Tomasz Stachowiak /+ a.k.a. h3r3tic +/
More information about the Digitalmars-d-bugs
mailing list