Lab7March Operator Overloading1
Lab7March Operator Overloading1
After going through Lab tasks, submit a separate Word document which should
include all the results of the tasks Code should be in word and output should be
screenshot.
First page should contain your Full name, Registration #, Course name and Date
Task 1
Write a class Distance that holds distances or measurements expressed in feet and inches.
This class has two private data members: feet: An integer that holds the feet. inches: An
integer that holds the inches.
2.1 Write a constructor with default parameters that initializes each data member of the class. If
inches are greater than equal to 12 then they must be appropriately converted to
corresponding feet
2.4 Define an operator- function that overloads the standard - math operator and allows subtracting
one Distance object from another. Distance operator-(const Distance &obj)
2.7 Define an operator= function that overloads the = operator and assign one Distance object to
another. const Distance operator=(const Distance &obj)