digitalmars.D.learn - Two interpretations
- JG (16/16) Jun 11 2021 Is it specified somewhere which way the following program will be
- H. S. Teoh (7/27) Jun 11 2021 The rule is that member functions will always take precedence over UFCS.
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); }
Jun 11 2021
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.
Jun 11 2021