bug: method override via overload

Ant Ant_member at pathlink.com
Tue Feb 21 06:59:47 PST 2006


In article <dtcpkd$23ii$1 at digitaldaemon.com>, Nick says...
>
>In article <dtcoqg$22lv$1 at digitaldaemon.com>, pragma says...
>>
>># typedef int Foo;
>># 
>># class Gorf{
>># 	public void bar(int x){} // return type here is immaterial (try 'int')
>># }
>># 
>># class Goat : Gorf{
>># 	public int bar(Foo x){}
>># }
>># 
>># void main(){
>># 	Foo y = 0;
>># 	int z = 0;
>># 	Goat g = new Goat();
>># 	g.bar(y); // works
>># 	g.bar(z); // fails
>># }
>
>This is by design, not a bug. When you introduce members with the same name in a
>child class, you automatically hide the inherited name from the parent. There
>are good reasons to do this

Where are those?
I try to look for them but only found the ones from Bjarne and Bright...

Ant





More information about the Digitalmars-d-bugs mailing list