[Issue 3345] Static and nonstatic methods with the same name should be allowed

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Aug 4 05:59:42 UTC 2021


https://issues.dlang.org/show_bug.cgi?id=3345

--- Comment #22 from Max Samukha <maxsamukha at gmail.com> ---
(In reply to Walter Bright from comment #15)
> > Otherwise there is no way to explain how .classinfo works in terms of D facilities.

> For code like this:
> 
>     int fun() { return 1; }
>     static int fun() { return 2; }
> 
> I cannot understand what purpose there is for writing such code.

It is a standard OOP practice. For example, 'Equals' in .NET's root class
https://docs.microsoft.com/en-us/dotnet/api/system.object?view=net-5.0#methods.

--


More information about the Digitalmars-d-bugs mailing list