示例#1
0
        public static Tanks operator *(Tanks t1, Tanks t2)
        {
            Tanks winner = new Tanks();

            if (t1.Ammunition > t2.Ammunition &&
                t1.Armor > t2.Armor)
            {
                winner = t1;
            }
            else if (t1.Ammunition > t2.Ammunition &&
                     t1.Maneuverablility > t2.Maneuverablility)
            {
                winner = t1;
            }
            else if (t1.Armor > t2.Armor &&
                     t1.Maneuverablility > t2.Maneuverablility)
            {
                winner = t1;
            }
            else
            {
                winner = t2;
            }
            return(winner);
        }
示例#2
0
        public override bool Equals(object obj)
        {
            if (this == obj)
            {
                return(true);
            }
            else if (obj == null || this.GetType() != obj.GetType())
            {
                return(false);
            }
            Tanks tanks = (Tanks)obj;

            return(this.TankType.Equals(tanks.TankType));
        }