g***e 发帖数: 577 | 1 Consider two possible interpreations of the following case
class x{
...
x(int);
friend x operator+ (x,x){...}
operator int(){...}
};
now in code
x y,z; ...some assignment afterwards...
y=z+2;
question: two possible conversions: z to int, then +2 ,then to x.
another way:2 to x then + z.
is this case allowable in C++ syntax? |
|