On Sat, 24 Jan 2015 18:55:58 +0000, tcak wrote:

> main.d ===================================================
> class Car{
>       public void makeBeep( char c ){}
>       public void makeBeep( string s ){}
> }
> 
> class Tesla: Car{
>       override public void makeBeep( char c ){
>               writeln("C = ", c);
>       }
> }
> 
> void main(){
>       auto t = new Tesla();
> 
>       t.makeBeep("Model S");
> }
> ===================================================
> 
> Error: function main.Tesla.makeBeep (char c) is not callable using
> argument types (string)
> 
> For Tesla, I expected that makeBeep( string s ) would still be defined.
> Because I have overridden on makeBeep( char c ). Isn't that correct?

nope. overriding overloaded function cancels all overloads. it's by spec.

Attachment: signature.asc
Description: PGP signature

Reply via email to