using System;

public class SurfaceVisitor: Visitor
{
  private double totalSurface;

  public double Surface
  {
    get { return totalSurface; }
  }

  public override void visit(Circle c)
  {
    if (c == null) return;
    totalSurface += Math.PI * c.Radius * c.Radius;
  }

  public override void visit(Rectangle r)
  {
    if (r == null) return;
    totalSurface += (double) r.Width * r.Height;
  }
}
