第二次作业

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication1
{
public class Time
{
int Year = 1995; int Month = 3; int Date = 11; int Hour; int Minute; int Second;
public void DisplayCurrentTime()
{
Console.WriteLine("{0},{1},{2},{3},{4},{5}", Year, Month, Date, Hour, Minute, Second);
}

public Time(int Year, int Month, int Date, int Hour, int Minute, int Second)
{
this.Year = Year;
this.Month = Month;
this.Date = Date;
this.Hour = Hour;
this.Minute = Minute;
this.Second = Second;
}
public Time(Time Timecopy)
{
Year = Timecopy.Year;
Month = Timecopy.Month;
Date = Timecopy.Date;
Hour = Timecopy.Hour;
Minute = Timecopy.Minute;
Second = Timecopy.Second;
}
}
public class Tester
{
static void Main()
{
Time t = new Time(1995,3,11,3,3,3);
t.DisplayCurrentTime();
Console.ReadLine();
Time t2 = new Time(t);
t2.DisplayCurrentTime();
Console.ReadLine();
}
}
}

原文地址:https://www.cnblogs.com/zeromaiko/p/4361231.html