public static AbstractHandler SetUpAnimalFeedChain2() { // The other part of the client code constructs the actual chain. var squirrel = new SquirrelHandler(); var dog = new DogHandler(); squirrel.SetNext(dog); return(squirrel); }
static void Main(string[] args) { Console.WriteLine("Chain of Responsibility!"); AbstractHandler squirrel = new SquirrelHandler(); AbstractHandler dog = new DogHandler(); squirrel.SetNext(squirrel).SetNext(dog); HandleRequest(squirrel); }