Question: c++ Part 3- Operator Overriding Program Write a class called Distance. The Distance class will have three data members: yards (an int), feet (an int),
c++
Part 3- Operator Overriding Program Write a class called Distance. The Distance class will have three data members: yards (an int), feet (an int), and inches (a float) Remember that there are 12 inches in a foot and 3 feet in a yard. Your Distance class should have the following member functions: default constructor This function initializes the Distance object to zero yards, zero feet, and zero inches constructor with three parms This function has parms for the yards, feet, and inches. It initializes the Distance object to the values given by the parms. setDist This function has parms for yards, feet, and inches, returns void. setDist sets the distance to the values given by the parms. Code and test the following operators for your Distance class: + add two Distances and return the sum - subtrct two Distances and return the difference compare two Distances and return true if they are the same compare two Distances and return true if the invoking object is less than the parm compare two Distances and return true if the invoking object is greater than the parnm
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
