How do I fix an “ambiguous” function call?

后端 未结 4 1199
礼貌的吻别
礼貌的吻别 2021-02-18 14:59

I\'m working on a C++ program for class, and my compiler is complaining about an \"ambiguous\" function call. I suspect that this is because there are several functions defined

4条回答
  •  我寻月下人不归
    2021-02-18 15:41

    Not sure why this isn't calling the int version of abs but you could try type casting the expression (amountOrdered - amountPaid) as int i.e.

    cout <<"Amount is: "<< abs( (int)(amountOrdered - amountPaint) );
    

提交回复
热议问题