Is there something I'm not getting here?

James Blachly james.blachly at gmail.com
Tue Oct 27 01:26:56 UTC 2020


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.

The "shorten" link on run.dlang.io no longer works, but here is a 
working example:

```
import std;

class A {
     public override string toString() {
         return "a";
     }
}

class B : A {
     public override string toString() {
	    return "b";
     }
}

void main()
{
     A a = new A();
     B b = new B();
     writeln(a);
     writeln(b);
}
```


More information about the Digitalmars-d-learn mailing list