开发者

What does the '&' means in a Unary Operator of a Class?

开发者 https://www.devze.com 2023-01-11 07:16 出处:网络
class 开发者_开发百科CDate { // some declarations public: CDate& operator ++ () { // increment function;
class 开发者_开发百科CDate
{
  // some declarations
  public: 
    CDate& operator ++ ()
    {
      // increment function;     
      return *this; 
    }
};

Does the '&' mean a reference that is being a return?

Thanks

SpecC


Yes, you answered your own question. CDate & simply means that the operator returns a reference to a CDate object. It has no special meaning because it's an operator, it means the same in any other function.

0

精彩评论

暂无评论...
验证码 换一张
取 消