//custom logic
 public override int compare(Comparable c1)
 {
     if (c1 is Animal)
     {
         Animal a = (Animal)c1;
         return name.CompareTo(a.Name);
     }
     else
     {
         throw new InvalidCastException();
     }
 }
 public override int compare(Comparable c1)
 {
     if (c1 is Integer)
     {
         Integer a = (Integer)c1;
         return zahl.CompareTo(a.Zahl);
     }
     else
     {
         throw new InvalidCastException();
     }
 }
示例#3
0
 public abstract int compare(Comparable c1);
 public abstract int compare(Comparable c1);