Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个带有转换功能的类。
class A { public: operator double() const; };
现在我在类定义之外定义它:
operator A::double() const { return 32.5; }
我正在使用带有 GCC4.7 的 MinGW,但出现错误:
error: expected type-specifier
有人知道我在做什么错吗?
你需要一个不同的顺序:
A::operator double() const {return 32.5;} ^The function name is "operator double"