Accessing a function within an object's superclass from the outside

David Zhang via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Jan 14 13:55:27 PST 2017


Hello,

Say I have a class, and it overrides a function from its 
superclass. However, the superclass has two overloaded versions 
of the same function. My intent is to override only one of the 
functions, but the second is rendered inaccessible from outside 
of the class. How can I make the overloaded function visible?

ie:

class ClassA {
     void fun(uint a) {}
     void fun(uint a, float b) {}
}

class ClassB: ClassA {
     void fun(uint a) {}
}

ca.fun(a);       //ok
ca.fun(a, b);    //ok
cb.fun(a);       //ok
cb.fun(a, b);    //function fun not callable with uint and float

I seem to remember something about using aliases to fix this, but 
I can't find anything about it either way.


More information about the Digitalmars-d-learn mailing list