My apologies if this is a dupe. I found a number of posts re. preventing implicit conversions, but nothing re. encouraging implicit constructions.
If I have:
class Rect
{
public:
Rect( float x1, float y1, float x2, float y2){};
};
and the free function:
Rect Scale( const Rect & );
why would
Rect s = Scale( 137.0f, 68.0f, 235.0f, 156.0f );
not do an implicit construction of a const Rect&
and instead generate this compiler error
'Scale' : function does not take 4 arguments
Because the language does not support this feature. You have to write
Rect s = Scale(Rect(137.0f, 68.0f, 235.0f, 156.0f));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With