The class IntCompSeq - Revisited. | Lecture 12 - slide 35 : 36 Program 6 |
public class IntCompSeq: IntSequence{ private IntSequence s1, s2; public IntCompSeq(IntSequence s1, IntSequence s2) { this.s1 = s1; this.s2 = s2; } public override int? Min{ get {return (s1.Min < s2.Min) ? s1.Min : s2.Min;} } public override int? Max{ get {return (s1.Max > s2.Max) ? s1.Max : s2.Max;} } public override IEnumerator GetEnumerator (){ foreach(int i in s1) yield return i; foreach(int i in s2) yield return i; } } |