public override int process(int runningTotal, int value)
 {
     if (value == 0)
     {
         ObserverManager.sendMessage(new ObserverMessage("Cannot divide by zero"));
         // The exception still needs to be thrown as the system is in an unstable state.
         throw new Exception("Cannot continue");
     }
     return(_proxiedClass.process(runningTotal, value));
 }
        static void Main(string[] args)
        {
            IFormula formula = new ImplFormula(new SafeSquareRootProxy(new ImplFormula(new EndPoint(), 1, 1)), 2, 2);

            formula.process(0, 4);

            ObserverReceiver rec = new ObserverReceiver();

            ObserverManager.addHandler(new ObserverHandler(rec.ObserverHandler));
            ObserverReceiverFile recFile = new ObserverReceiverFile();

            ObserverManager.addHandler(new ObserverHandler(recFile.ObserverHandler));
            formula = new ImplFormula(new SafeSquareRootProxyWithObserver(new ImplFormula(new EndPoint(), 1, 1)), 2, 2);
            formula.process(0, 0);
        }