December 01, 2004 need 'this' to access member | ||||
---|---|---|---|---|
| ||||
class A { void foo(int i) {} void foo(float f) {} } class B: A { alias A.foo foo; // (9) override void foo(int i) { foo(); } // (10) void foo() {}; } void main() { B b; b.foo(1.0f); } DMD 0.108 outputs: ta.d(10): need 'this' to access member foo If (10) rewrite as 'override void foo(int i) { this.foo(); } program compiles successfully. |
Copyright © 1999-2021 by the D Language Foundation