Beispiel #1
0
 public bool Equals(Collection other)
 {
     if (other == null)
         return false;
     if (this == other)
         return true;
     if (this.pos != other.pos)
         return false;
     for (int i = 0; i < this.pos; i++)
     {
         if (this.nums[i] != other.nums[i])
             return false;
     }
     return true;
 }
Beispiel #2
0
        static void Main(string[] args)
        {
            /*
            //Collection myCollection = new Collection(100);
            try
            {
                int q = Quotient(7, 0);
                Console.WriteLine("q=" + q);
            }
            catch(Exception ex)
            {
                Console.WriteLine("boom! " + ex.Message);
            }
            Console.WriteLine("done");
            */

            Collection col1 = new Collection();
            Collection col2 = new Collection();

            col1.Add(3);
            col1.Add(1);
            col1.Add(19);
            col1.Add(80);
            Console.WriteLine(col1.Equals(col1));
        }