helo guys
i have class call Complex
I did operator overloading like such
Complex c = a + b; // where a and b are object of Complex class
which basically is operator+(Complex& that);
but I dont know how to say for example
double c = a + 10; //where a is object of Complex class but 10 is integer / double
I did define typecasting for a to be double get my IDE says that there are too many operands + and it somehow complains for not being able to "understand" the +
it has to be in this format though double c = a + 10;
thanks
error message is
Error: more than one operator "+" matches these operands:
error C2666: 'Rational::operator +' : 3 overloads have similar conversions
1> could be 'const Complex Complex::operator +(const Complex &)' 1>
or 'double operator +(const Complex &,double)'
the compiler can not pick based on signature ? and yes I did define it outside the class because I had one defined inside the class thanks