class x is hidden by y
Benjamin Thaut
code at benjamin-thaut.de
Wed Oct 6 23:43:12 PDT 2010
For the following code in D 2.0 using dmd 2.049:
import std.stdio;
abstract class foo {
protected:
void WrongType(){
assert(0,"Using wrong type");
}
public:
void Update(int value){WrongType();}
void Update(float value){WrongType();}
}
class blup : public foo {
public override void Update(int value){
writefln("%s",value);
}
}
void main(string[] argv){
foo s = new blup();
s.Update(2);
s.Update(2.5f);
}
When compiling with -w option I get the following warning:
test.d(25): Error: class test.blup test.foo.Update(float value) is hidden by blup
When compiling without the -w option I get the following runtime error:
core.exception.HiddenFuncError: Hidden method called for test.blup
So I don't get why void Update(float value) is hidden. I come from C++ so
please show me my mistake.
Kind Regards
Benjamin Thaut
More information about the Digitalmars-d-learn
mailing list