예제 #1
0
 static void Main1(string[] args)
 {
     Time t1 = new Time(10, 20, 30);
     Time t2 = new Time(10, 20, 30);
        // t2 = t1;
     if (t1.Equals(t2))
     {
         Console.WriteLine("Equal");
     }
     else
     {
         Console.WriteLine("Not Equal");
     }
 }
예제 #2
0
 static void Main2(string[] args)
 {
     Time t1 = new Time(10, 1, 20);
     Time t2 = new Time(1, 20, 30);
     Time t3;
     t3 = t1 + t2; // Time.operator+(t1,t2);
     if (t1 > t2)  //Time.operator>(t1,t2)
     {
         Console.WriteLine("t1 is greater");
     }
     else
     {
         Console.WriteLine("t2 is greater");
     }
 }
예제 #3
0
 static void Main()
 {
     Time t1 = new Time(1, 1, 2);
     Console.WriteLine(t1[10]);
 }
예제 #4
0
파일: Time.cs 프로젝트: prijuly2000/Dot-Net
 public static Time operator +(Time t1, Time t2)
 {
     Time t = new Time();
     t.hr = t1.hr+t2.hr;
     t.min = t1.min + t2.min;
     t.sec = t1.sec + t2.sec;
     return t;
 }