| using System;
using System.Collections;
public struct Interval{
private readonly int from, to;
private readonly bool empty;
// Construct a non-empty interval [from - to].
public Interval(int from, int to){
this.empty = false;
this.from = from;
this.to = to;
}
// Construct an empty interval. The parameter is a dummy.
public Interval(int notUsed){
this.empty = true;
this.from = 0; // not really used
this.to = 0; // not really used
}
// Illegal constructor. Compile-time error.
// Structs cannot contain explicit parameterless constructors
public Interval(){
this.empty = true;
this.from = 0;
this.to = 0;
}
// Other Interval operations not shown
} |