Bug or feature?

Ali Çehreli via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun May 10 10:48:33 PDT 2015


On 05/10/2015 10:18 AM, Jack Applegame wrote:
> 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)

It is a concept called "name hiding". It is intentional to prevent at 
least "function hijacking".

Ali



More information about the Digitalmars-d-learn mailing list