Пример #1
0
        public override bool Equals(object x)
        {
            Coder obj = (Coder)x;

            if (this.surname == obj.surname && this.salary == obj.salary && this.bossSurname == obj.bossSurname)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Пример #2
0
        public static Coder operator +(Coder x, Coder y)
        {
            Coder tmp = new Coder();

            tmp.surname     = x.surname;
            tmp.bossSurname = x.bossSurname;
            tmp.salary      = x.salary + y.salary;

            string[] tm = new string[x.duties.Length + y.duties.Length];
            Array.Copy(x.duties, tm, x.duties.Length);
            Array.Copy(y.duties, tm, y.duties.Length);
            tmp.duties = tm;

            Worker[] tm1 = new Worker[x.subordinates.Length + y.subordinates.Length];
            Array.Copy(x.subordinates, tm1, x.subordinates.Length);
            Array.Copy(y.subordinates, tm1, y.subordinates.Length);
            tmp.subordinates = tm1;

            return(tmp);
        }