// Counter.cs 

namespace WinDevMagazine {

  public interface ICounter {
    void increment();
    void decrement();
    void clear();
    int  count { get; }
  }

  public class Counter : ICounter {
    private int count_;
    public Counter() { clear(); }
    public void increment() { ++count_; }
    public void decrement() { if ( count_ > 0 ) --count_; }
    public void clear() { count_ = 0; }
    public int count { get { return count_; } }
  }

}
