Hi All
Can somebody clear my query that why the second operand of '+' operator is called first in the code below?
When operator '+' takes left to right.
#include <iostream>
using namespace std;
class A
{
int i;
public:
A(int i=-1){cout<<"A const i = "<< i <<endl;}
int operator+(const A &a)
{
cout<<"operator + "<<endl;
return 1;
}
};
int main()
{
A(10) + A(18); // A(18) is constructed first !! Why??
return 0;
}