/**
 * Illustration of upcasting.
 * 
 * @author Drue Coles
 */
public class PetDemo1 {

    public static void main(String[] args) {
        
        // Inheritance expresses an is-a relationship. Here we can say that a
        // dog (subtype) is a kind of pet (supertype). Wherever a superclass
        // reference is required, a subtype reference is valid. The upcast is 
        // implicit.
        Pet myPet = new Dog("Isaak", 12945); 
        
        // The following statement would not compile:
        //
        // myPet.fetchStick();
        //
        // But why not? The variable myPet refers to an instance of the Dog 
        // class, which has a fetchStick method, so what is the problem?
    }
}