class Animal {
    int age;
    void speak() {
        System.out.println("동물이 소리를 냅니다.");
    }
}

class Dog extends Animal {
    String type;
    @Override
    void speak() {
        System.out.println("멍멍");
    }
}

public class UpcastingTest {
    public static void main(String[] args) {
        Animal a = new Dog(); // ① 업캐스팅
        a.speak(); // 출력 결과: 멍멍
    }
}