I was wondering - why is putting const (...)& in C++ a good idea? I found this code in some class tutorials. I understand that const is making something constant and it can't be changed, while & is passing it to the function. Why do both? If I can't change something, why should I be passing it to the function?
Here is an example:
class CVector {
      public:
        int x,y;
        CVector () {};
        CVector (int a,int b) : x(a), y(b) {}
        CVector operator + (const CVector&);
    };
    CVector CVector::operator+ (const CVector& param) { //example 
      CVector temp;
      temp.x = x + param.x;
      temp.y = y + param.y;
      return temp;
    }
 
     
     
     
     
    