Let the source code speak for itself:
MLine::MLine(int x1, int y1, int x2, int y2)
{
}
MLine::MLine(double x1, double y1, double x2, double y2)
{
}
void __fastcall TVctDiag2::PrepareArrowTail(int x, int y)
{
double length_x1;
double length_y1;
MLine *line = new MLine(x, y, x - length_x1, y - length_y1);
}
Compiler generates following error:
E2015 Ambiguity between 'MLine::MLine(int,int,int,int) at shapes.h:100' and 'MLine::MLine(double,double,double,double) at shapes.h:110'
I can resolve this problem by following explicit casting:
MLine *line = new MLine((double)x, (double)y, x - length_x1, y - length_y1);
The partial casting is not sufficient:
MLine *line = new MLine((double)x, y, x - length_x1, y - length_y1);
I am quite confused about rules for implicit casting in expressions. Can someone explain this behaviour? What is the data type of expressions 'x - length_x1' and 'y - length_y1'?