Distance Class with > and < Operators
Explore how to create a Distance class in C++ that stores meters and centimeters and overload the > and < operators to compare distance objects. Understand operator overloading mechanics by coding comparisons between instances to determine relative size. This lesson improves your skills in custom operator implementation within classes.
We'll cover the following...
We'll cover the following...
Challenge
Write a program that implements a Distance class that records the distance in meter and centimeter. Overload the > and < operator in it to check whether one Distance object is smaller or greater than the ...