Is there something I'm not getting here?

matheus matheu at gmail.com
Tue Oct 27 02:21:39 UTC 2020


On Tuesday, 27 October 2020 at 01:26:56 UTC, James Blachly wrote:
> On 10/26/20 9:19 PM, Ruby The Roobster wrote:
>> Following code doesn't work(it's not the actual code but it 
>> represents it). Is there some rule about function overrides 
>> that I don't know about?
>> 
> ...
>> The error I keep getting no matter what says: Error: Multiple 
>> Overrides of Same Function. Anybody know what I should do?
>
> It works for me.
> ...

I think he is referring to this:

import std;

class B{
     public override string toString(){
         return null;
     }

     public override string toString(){
         return toString(null);
     }
}

void main() {
     B b = new P();
}

Error: function `B.toString` multiple overrides of same function

You can view: https://www.jdoodle.com/iembed/v0/3rm

Matheus.


More information about the Digitalmars-d-learn mailing list