class Complex { double real, image;public: Complex(...) {} operator double () { return real; }}main() { Complex c(1.2, 3.4); cout << (double)c << endl; // 输出 1.2 double n = 2 + c; // 等价于 double n = 2 + c.operator double() cout << n; // 输出 3.2}