// Adapted from 
// http://www.javaworld.com/article/3033445/learn-java/java-101-polymorphism-in-java.html
public class OverrideTester {
    public static void main (String args []) {
        // BaseClass reference and object
        OverrideBaseClass obj1 = new OverrideBaseClass(); 
        // BaseClass reference but DerivedClass object
        OverrideBaseClass obj2 = new OverrideDerivedClass(); 
        // Calls the methods from BaseClass class
        System.out.println("I'm an object of class " + obj1.getClass());
        obj1.methodToOverride();
        obj1.methodNotToOverride();
        //Calls the methods from DerivedClass class
        System.out.println("I'm an object of class " + obj2.getClass());
        obj2.methodToOverride();
        obj2.methodNotToOverride();
    }    
}
