c#编写一个名为time的类,该类能够存放时间信息,并且具有设置时间和显示时间的功能, 20
1个回答
展开全部
class time
{
DateTime m_date;
/// <summary>
/// 设置或获取时间
/// </summary>
public DateTime Time { get { return m_date; } set { m_date = value; } }
public time() :this(default(DateTime))
{
}
public time(long ticks) :this(new DateTime(ticks))
{
}
public time(DateTime date)
{
m_date = date;
}
public static time operator +(time d, time t)
{
return new time(d.m_date.AddTicks(t.m_date.Ticks));
}
public static time operator -(time d, time d2)
{
return new time(d.m_date.Ticks-d2.m_date.Ticks);
}
}
测试自己弄
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询