Implicit const
Frits van Bommel
fvbommel at REMwOVExCAPSs.nl
Thu Apr 3 15:59:22 PDT 2008
Craig Black wrote:
> Just don't issue the warning if the function is overriden. The compiler
> could be smart enough to do that.
The compiler only looks at the files needed to compile the current
module, i.e. all modules imported from it (directly or indirectly).
So if a method is only overridden in files not imported from the one
containing the base class, it has no way of knowing about it...
For example:
----
module a;
class B {
int foo() { return 42; }
}
----
module b;
import a;
class D : B {
private int foo_value;
int foo() { return foo_value; }
}
----
While compiling module 'a' above, the compiler doesn't look at module
'b', so it won't know about D overriding foo(). Or even that class D
exists, for that matter.
More information about the Digitalmars-d
mailing list