码迷,mamicode.com
首页 > 其他好文 > 详细

Overrid Equals Defined Operator

时间:2017-04-20 16:07:13      阅读:133      评论:0      收藏:0      [点我收藏+]

标签:weight   com   nbsp   comm   set   rri   err   style   shc   

 public class Common
    {

        public override int GetHashCode()
        {
            return base.GetHashCode();
        }
        public override bool Equals(object obj)
        {
            return base.Equals(obj);
        }
        public int WeightMax { get; set; } = 0;
        public int WeightLarge { get; set; } = 0;
        public int WeightSmall { get; set; } = 0;
        public int WeightMin { get; set; } = 0;
        public static bool operator ==(Common m1, Common m2)
        {
            if (m1.WeightLarge == m2.WeightMax) return true;
            return false;
        }
        public static bool operator !=(Common m1, Common m2)
        {
            if (m1.WeightMax != m2.WeightLarge) return true;
            return false;
        }
    }

 

Overrid Equals Defined Operator

标签:weight   com   nbsp   comm   set   rri   err   style   shc   

原文地址:http://www.cnblogs.com/Javi/p/6739250.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!