operator overloading outside the type
Nick Treleaven
nick at geany.org
Sat Mar 29 16:07:45 UTC 2025
On Saturday, 29 March 2025 at 16:00:16 UTC, Timon Gehr wrote:
> ```
> import std.stdio;
>
> struct S{
> void foo(){ writeln("member"); }
> }
>
> struct T{
> S s;
> alias this=s;
> }
>
> void foo(S s){ writeln("ufcs"); }
I think `foo` should be `void foo(T t)`, but it still prints
"member" anyway :-)
> void main(){
> T t;
> t.foo();
> }
> ```
>
> Prints "member" (of course).
More information about the Digitalmars-d
mailing list