class Animal {
  public String getSound() { return "default"; }

  public int getCount() { return count; }

  public int count;
}

class Cow extends Animal {
  public String getSound() { return "moo"; }

  public void milk() { System.out.println("milking..."); }
}

class Dog extends Animal {
  public int getCount() { return count; }

  public int count;
}

class example {

  public static void main( String[] args ) {

    Cow c = new Cow();
    Dog d = new Dog();

    c.milk();
    System.out.println("the cow says " + c.getSound());
    System.out.println("the dog says " + d.getSound());

    Animal a = c;
    Animal b = d;

    System.out.println("the cow says " + a.getSound());
    System.out.println("the dog says " + b.getSound());

//    a.milk();     
    ((Cow)a).milk();
//    ((Cow)b).milk(); 

    c.count = 10;
    d.count = 5;

    System.out.println(c.count + " " + d.count); 
    System.out.println(c.getCount() + " " + d.getCount());

    System.out.println(a.count + " " + b.count); 
    System.out.println(a.getCount() + " " + b.getCount()); 
  }

}
