Because of the comma operator and the non-explicit constructor. The expression (a + r * xCoord , a + r * yCoord)
is an application of the comma operator and has the value a + r * yCoord
, and now the one-parameter implicit form of your Point
constructor is used with this value, and the second parameter is defaulted.
You can prevent such mistakes from creeping in by making the constructor explicit
, which is generally recommended for any constructor that can be called with one argument, unless you really want implicit conversions.
To get your desired behaviour, you want direct initialization:
Point p(a + r * xCoord, a + r * yCoord);