/**
 * Demonstrates overload variant method selection.
 * Java matches on compile time reference type.
 */

public class Barking
   {

   String bark ( Dog d )
      {
      return "arf";
      }

   // overloads bark
   String bark ( Dalmatian d )
      {
      return "woof";
      }

   public static void main( String[] args )
      {
      Dog dog = new Dalmatian();

      // prints "arf"
      out.println( bark( dog ) );

      }
   }