package com.lovecoding.day09.duotai02;

public class TestArr {
    public static void main(String[] args) {

        //父类类型
        Pet[] pets = new Pet[2];

        Dog dog = new Dog();
        dog.setName("沙皮");

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

        pets[0] = dog;
        pets[1] = cat;

        for (int i = 0; i < pets.length; i++) {
            System.out.println(pets[i]);
        }


    }
}
