package chapter23;

/**
 * Created by IntelliJ IDEA.
 * User: Administrator
 * Date: Oct 3, 2008
 * Time: 8:26:57 PM
 * To change this template use File | Settings | File Templates.
 */
public class PolymorphismDemo {
    public static void main(String[] args) {
        m(new GraduateStudent());
        m(new Student());
        m(new Person());
        m(new Object());
    }

    public static void m(Object x) {
        System.out.println(x.toString());
    }
}

class Student extends Person {
    public String toString() {
        return "Student";
    }
}

class Person extends Object {
    public String toString() {
        return "Person";
    }
}

