Question: Create a Point class, implement Equality operator, Inequality operator, Comparison operator ( four ) , Insertion operator ( make it as friend of Point class

Create a Point class, implement Equality operator, Inequality operator, Comparison operator (four), Insertion operator (make it as friend of Point class), Arithmetic operators and Compound Assignment operator.
Show the Point class and explain to your teaching assistant step by step by using the four test cases.
Lastly, overload the subscript operator: [], dereference (indirection) operator: *, and apply Rule of three to the Array class (given below by my code).
Header File for step 3:
#include
#include
#include
using namespace std;
class Array {
public:
explicit Array(int sizeValue); //constructor. Use explicit when there is one paramater.
Array(const Array& origArray); //copy constructor
~Array();
private:
int* data;
int size;
CPP file for step 3:
#include "Array.h"
#include
using namespace std;
Array::Array(int sizeValue): size(sizeValue)
{
data = new int[sizeValue];
}
Array::Array(const Array& myArray): size(myArray.size)//This specific line of code still confuses me. Specifically, const Array& myArray.
{
data = new int[myArray.size];
for (int i =0; i < myArray.size; i++)
{
data[i]= myArray.data[i];
}
}
Array::~Array()
{
delete[] data;
I do not know what a friend function is. I also do not know what an insertion operator is. I have never heard of these things. Could you explain what these are and what to do for the problem? Below is the rest of the UML.
Private:
int x
int y
Public:
+Point(int x, int y)// constructor
+operator==(other: Point)
+operator!=(other: Point)
+operator<(other: Point)
+operator>(other: Point)
+operator<=(other: Point)
+operator>=(other: Point)
+operator<<()(friend of Point class)(No idea what this is. Please explain what an insertion operator is/does as well as a friend function in addition to how to implement them.)
+operator+(value: int)
+operator+=(value: int)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!