Re: Overloading operators

From: Ulrich Eckhardt (doomster_at_knuut.de)
Date: 03/10/04

  • Next message: Sumit Rajan: "Re: Overloading operators"
    Date: Wed, 10 Mar 2004 08:48:43 +0100
    
    

    Conditional Zenith wrote:
    > If I overload the + operator, is the += operator implicitly
    > overloaded or do I need to overload it separately?

    You need to do it yourself. In fact, you might rather overload += and then
    implement operator+ like this

    type operator+(type const& t1, type const& t2)
    {
      type res = t1;
      res += t2;
      return res;
    }

    Uli

    -- 
    FAQ: http://ma.rtij.nl/acllc-c++.FAQ.html
    

  • Next message: Sumit Rajan: "Re: Overloading operators"