为什么下面的 C++ 程序输出“ABaBbAc”?
#include "stdafx.h"
#include <iostream>
using namespace std;
class A {
public:
int i;
A(int j=0):i(j)
{
cout<<"A";
}
operator int()
{
cout<<"a";
return 2;
}
};
class B {
public:
B(int j=1):i(j){
cout<<"B";
}
operator int() {
cout<<"b";
return 3;
}
int i;
};
int operator+(const A&a, const B&b){
cout<<"C";
return a.i + b.i;
}
int main()
{
A a;
B b;
int i = (A)b + (B)a;
return 0;
}