D1/D2: How to check if a method has been overridden
klickverbot
see at klickverbot.at
Tue Sep 7 14:33:56 PDT 2010
On 9/7/10 11:31 PM, bearophile wrote:
> Have you tried to compile that code with -w?
> See also:
> http://d.puremagic.com/issues/show_bug.cgi?id=4216
>
> Bye,
> bearophile
Well, I guess I should have wrote the following instead:
---
class A {
void foo( float a ) {}
void foo( int a ) {}
final void bar() {
// Determine whether this.foo( 1 ) and this.foo( 1f ) really refer
// to A.foo( float ) and A.foo( int ) or if they point to a subclass
// implementation – how?
}
}
class B : A {
alias A.foo foo;
override void foo( float a ) {}
}
class C : A {
alias A.foo foo;
override void foo( int a ) {}
}
class D : B {
alias B.foo foo;
override void foo( int a ) {}
}
---
More information about the Digitalmars-d
mailing list