![]() ![]() ![]() | sequence/natural-oo-visitor-motivation/App.cs - A sample application of IntSequences. | Lecture 8 - slide 34 : 37 Program 5 |
using System; class SeqApp { public static void Main(){ IntSequence isq = new IntCompSeq( new IntCompSeq( new IntInterval(3,5), new IntSingular(-7) ), new IntCompSeq( new IntInterval(12,7), new IntCompSeq( new IntInterval(18,-18), new IntInterval(3,5) ))); Console.WriteLine("Min: {0} Max: {1}", isq.Min, isq.Max); Console.WriteLine("Sum: {0}", isq.Sum()); } }