Question: C++ Operator Overloading Add the requested functionality to the Distance class below: class Distance { private: int feet; int inches; public: Distance(int inch) { feet

C++ Operator Overloading

Add the requested functionality to the Distance class below:

class Distance {

private:

int feet;

int inches;

public:

Distance(int inch) { feet = inch/12; inches = inch % 12; };

Distance(int f, int i) { feet=f; inches=i; };

//Overloaded + that will add two distance objects and return sum in a

//distance object

//Conversion function (to type int) that will return the distance in inches

//Overloaded pre-increment operator that adds 1 to inches

//Overloaded post-increment operator that adds 1 to inches

}; //end Distance

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!