package chapter4.example14;

abstract class Animal {
    abstract void shout();
}

class Cat extends Animal {
    public void shout() {
        System.out.println("喵喵...");
    }
}

class Dog extends Animal {
    public void shout() {
        System.out.println("汪汪...");
    }
}

class Example14 {
    public static void main(String[] args) {
        Animal cat = new Cat();
        Animal dog = new Dog();

        cat.shout();
        dog.shout();
    }
}

class Example15 {
    public static void main(String[] args) {
        Dog dog = new Dog();
        Animal an = dog;

        an.shout();
    }
}
