#include <iostream>

using namespace std;

// class Time
// Goal: manage time with hour, min, seconds
// funtion: perform plus, minus, comparison....

class Time {

	// private member variable (Data)
	int h;	// 0~23
	int m;	// 0~59
	int s;	// 0~59

	// public member function
public:
	// Constructor
	Time() { h=m=s=0; }
	Time( int hour, int min, int sec ) { h=hour; m=min; s=sec; }

	// accessor (getter)
	int getHour() { return h; }
	int getMin() { return m; }
	int getSec() { return s; }

	// accessor (setter)
	void setHour( int hour ) { if( 0 <= hour && hour <= 23 ) h = hour; }
	void setMin( int min ) { if( 0 <= min && min <= 59 ) m = min; }
	void setSec( int sec ) { if( 0 <= sec && sec <= 59 ) s = sec; }

	friend Time operator+( Time t1, Time t2 );

};

Time operator+( Time t1, Time t2 ) {
	Time t;
	t.h = t1.h + t2.h;
	t.m = t1.m + t2.m;
	t.s = t1.s + t2.s;
	return t;
}

int main() {
	Time t1(1, 2, 3);
	Time t2(2, 3, 4);
	Time t3 = t1 + t2;
	cout << "t3 is " << t3.getHour() << " hour, " << t3.getMin() << "min, " << t3.getSec() << "sec." << endl;
	system( "pause" );
}