package com.sf.day09.many;

public class Dog extends Animal{
    @Override
    public void eat() {
        System.out.println("小狗在吃饭");
    }


    public static void main(String[] args) {
        Dog dog = new Dog();
        dog.eat();
        Cat cat = new Cat();
        cat.eat();

        Animal animal = new Cat();
        Cat cat1 = (Cat) animal;
        if(animal instanceof Cat){
            cat1.run();
        }else {
            Dog dog1 = (Dog) animal;
        }
        dog.eat();



//        Cat cat1 = new Cat();
        animal.eat();
//        animal.run();   多态的弊端



    }
}
