c ++中的operator关键字用法

时间:2016-10-10 19:37:40

标签: c++ operator-keyword

我知道operator关键字可用于重载运算符,例如+=-=甚至函数调用运算符()

我遇到了这段代码,无法理解行AB的语法。

这两条线做什么?如果它们声明了函数,那么函数应该如何使用?

using INT64 = long long;
class Time
{
public:
    INT64 microseconds;                               // data member
    Time() : microseconds(0) { }                      // default constructor
    Time& operator+= (const INT64 msec);              // overloads += operator
    operator INT64 () const { return microseconds; }; // line A ???
    operator const timespec() const;                  // line B ???
}

0 个答案:

没有答案