protected override bool resolve(Trouble trouble) { if (trouble.Number % 2 == 1) { return(true); } return(false); }
public void DoSupport(Trouble trouble) { if (resolve(trouble)) { done(trouble); } else if (Next != null) { Next.DoSupport(trouble); } else { fail(trouble); } }
protected override bool resolve(Trouble trouble) { return(false); }
protected void fail(Trouble trouble) { Console.WriteLine($"{trouble} cannot be resolved."); }
protected void done(Trouble trouble) { Console.WriteLine($"{trouble} is resolved by {this}."); }
protected abstract bool resolve(Trouble trouble);