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.
可能重复: 运算符重载
我在一段示例代码中看到了这一点:
operator Vector2<float>() const { return Vector2<float>(x, y); }
我对此有两个问题:
1) 函数明确返回,但没有指定返回类型?
2)目前尚不清楚这里究竟是什么重载,哪个运算符。
它是一个转换运算符,返回类型是Vector2<float>.
Vector2<float>