Question: USING C++: Referring to the header file below named coord2d.h, Implement each of the 8 operator overloads (operators: < , p2 will true if a>c
USING C++:
Referring to the header file below named coord2d.h, Implement each of the 8 operator overloads
(operators: <<, [], >, <, two versions of +, two versions of *)
#ifndef COORD2D_H #define COORD2D_H #includeusing namespace std; //implement a class that keeps track of the coordinates of a point in the X-Y plane class coord2d { //overload the << operator so that if p is of type "coord2d" then "cout< operator as a friend function so that if p1 and p2 are of type "coord2d" //p1=(a,b), p2=(c,d) //then p1>p2 will true if a>c and b>d. It will return false otherwise //p1, p2 should not change friend bool operator>(const coord2d&, const coord2d&); //overload the < operator as a friend function so that if p1 and p2 are of type "coord2d" //p1=(a,b), p2=(c,d) //then p1
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
