Another Example of Classes - 3

This is how you might use the MyTime class:
#include <iostream.h>
#include "MyTime.h"

void main(void)
{
  MyTime time1, time2;
  MyTime time3(10, 25, 30);

  time2.Set(10, 25, 30);
  time1.Display();
  time2.Display();
  time3.Display();

  if (time2.isEqual(time3))
    cout << "time2 == time3" << endl;
  else
    cout << "time2 != time3" << endl;

  if (time3.isGreater(time1))
    cout << "time3 > time1" << endl;
  else
    cout << "time3 is NOT > time1" << endl;
}
Output
 0: 0: 0
10:25:30
10:25:30
time2 == time3
time3 > time1
Previous page

Back to Index
Back to Outline