package com.lovecoding.day09.duotai01;

public class TestPet {
    public static void main(String[] args) {
        //多态格式
        Pet pet = new Dog();
        pet.setName("沙皮");
        //编译看左边 运行看右边
        //pet.eat();

        //不能调用特有的方法
        //pet.lookHome();

        //参数
        Person person = new Person();
        //喂养
        person.feedPet(pet);//new Dog(); 狗类

        Dog dog = new Dog();
        dog.setName("二哈");

        person.feedPet(dog);

        Cat cat = new Cat();
        cat.setName("波斯猫");
        person.feedPet(cat);

    }
}
