include a functionality to overload stream extraction operator Include a functionality to overload stream insertion operator Overload power operator #include using namespace std; class CVector { int...


include a functionality to overload stream extraction operator


Include a functionality to overload stream insertion operator


Overload power operator











#include


using namespace std;


class CVector {


 int x,y;


 public:


 CVector () {};


 CVector (int,int);


 CVector operator + (CVector);


 void print();



};


void CVector::print()


{


              cout < ","=""><>


}


CVector::CVector (int x, int y) {


 this->x = x;


 this->y = y;


}


CVector CVector::operator+ (CVector param) {


 CVector temp;


 temp.x = this->x + param.x;


 temp.y = this->y + param.y;


 return temp;


}


int main () {


 CVector a (3,1);


 CVector b (4,9);


 CVector c;


 c = a.operator +(b);


 c.print();


 return 0;


}





Jun 02, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here