digitalmars.D.learn - Bug or feature?
- Jack Applegame (3/13) May 10 2015 Error: function B.test () is not callable using argument types
- =?UTF-8?B?QWxpIMOHZWhyZWxp?= (4/16) May 10 2015 It is a concept called "name hiding". It is intentional to prevent at
- Jonathan M Davis via Digitalmars-d-learn (10/27) May 10 2015 Yeah. You have to alias A's overloads inside of B or explicitly declare ...
- Jack Applegame (1/1) May 10 2015 Ok, it's a feature. Thanks.
- Manfred Nowak (14/15) May 10 2015
code:class A { void test(int) {} } class B : A { void test() { super.test(1); // compiles test(10); // error } }Error: function B.test () is not callable using argument types (int)
May 10 2015
On 05/10/2015 10:18 AM, Jack Applegame wrote:code:It is a concept called "name hiding". It is intentional to prevent at least "function hijacking". Aliclass A { void test(int) {} } class B : A { void test() { super.test(1); // compiles test(10); // error } }Error: function B.test () is not callable using argument types (int)
May 10 2015
On Sunday, May 10, 2015 10:48:33 Ali Çehreli via Digitalmars-d-learn wrote:On 05/10/2015 10:18 AM, Jack Applegame wrote:Yeah. You have to alias A's overloads inside of B or explicitly declare them as overrides and call the A versions from inside them. So, something like alias A.test test; or alias test = A.test; inside of B should work (though I haven't done it recently, so the syntax might be slightly off), or you can just do override void test(int i) { super.test(i); } - Jonathan M Daviscode:It is a concept called "name hiding". It is intentional to prevent at least "function hijacking".class A { void test(int) {} } class B : A { void test() { super.test(1); // compiles test(10); // error } }Error: function B.test () is not callable using argument types (int)
May 10 2015
Jack Applegame wrote:One can "import" the declaration by using an alias: class A { void test(int) {} } class B : A { alias test= super.test; void test() { super.test(1); // compiles test(10); // compiles } } -manfredtest(10); // error
May 10 2015