On Fri, Jun 11, 2021 at 03:00:00PM +0000, JG via Digitalmars-d-learn wrote:
> Is it specified somewhere which way the following program will be
> interpreted?
> 
>     import std;
> 
>     struct A
>     {
>         int x=17;
>     }
> 
>     int x(A a)
>     {
>         return 100*a.x;
>     }
> 
>     void main()
>     {
>         A a;
>        writeln(a.x);
>     }

The rule is that member functions will always take precedence over UFCS.
UFCS only kicks in when the member function of that name cannot be
found.


T

-- 
For every argument for something, there is always an equal and opposite 
argument against it. Debates don't give answers, only wounded or inflated egos.
  • Two interpretations JG via Digitalmars-d-learn
    • Re: Two interpretations H. S. Teoh via Digitalmars-d-learn

Reply via email to