Ok here is a base to get you started. You will have to add the logic for the + overload, as well as proper bounds checking.
Code:
class Time
{
//Provide some bounds checking in set for being greater then 59...
public int Hours { get; set; }
public int Minutes { get; set; }
public int Seconds { get; set; }
public Time()
{
Hours = 12;
Minutes = 0;
Seconds = 0;
}
public Time(int Hours, int Minutes, int Seconds)
{
this.Hours = Hours;
this.Minutes = Minutes;
this.Seconds = Seconds;
}
public static Time operator+(Time ToAdd)
{
//Add ToAdd to a new instance of Time and return it.
return null; //Take this out...
}
public override string ToString()
{
StringBuilder RetString = new StringBuilder();
RetString.Append(Hours.ToString().PadLeft(2, '0') + ":" + Minutes.ToString().PadLeft(2, '0') + ":" + Seconds.ToString().PadLeft(2, '0'));
return RetString.ToString();
}
}