Overload all relational operators (<, >, <=, >=, ==, and !=) for Distance class. A sample output is given below: Distance d1: 3'-9" Distance d2: 3'-6" d1 is larger than d2
OOPs
In today's technology-driven world, computer programming skills are in high demand. The object-oriented programming (OOP) approach is very much useful while designing and maintaining software programs. Object-oriented programming (OOP) is a basic programming paradigm that almost every developer has used at some stage in their career.
Constructor
The easiest way to think of a constructor in object-oriented programming (OOP) languages is:
Overload all relational operators (<, >, <=, >=, ==, and !=) for Distance class. A sample
output is given below:
Distance d1: 3'-9"
Distance d2: 3'-6"
d1 is larger than d2
For validation checks, you may assume that all inputs are correct but your overloaded
operator functions must check if the operation result becomes invalid, e.g., distance
becomes negative after a larger distance is subtracted from a smaller one (show an error
in such case) or inches become >=12 (update inches and feet values in such case
using c++
Step by step
Solved in 3 steps with 1 images