Example: Calculate Difference Between Two Time Periods
Output
TIME DIFFERENCE: 12:34:55 - 8:12:15 = 4:22:40
In the above program, we've created a class named Time with three member variables: hours, minutes, and seconds. As the name suggests, they store hours, minutes and seconds of a given time respectively.
The Time class has a constructor that initializes the value of hours, minutes, and seconds.
We've also created a static function difference that takes two Time variables as parameters, find the difference and returns it as Time class.