public class DynamicBinding {
	public static void main(String[] args) {
		C1 myC1 = new C1();
		myC1.hello();

		myC1 = new C2();
		myC1.hello();

		System.out.println("invoking sHello...");
		((C2) myC1).sHello();
	} //main()
} //class DynamicBinding

class C1 {
	public void hello() {
		System.out.println("Hello from class C1");
	} //hello()
} //class C1

class C2 extends C1 {
	public void hello() {
		System.out.println("Hello from class C2");
	} //hello()

	public void sHello() {
		super.hello();
		hello();
	} //superHello()
} //class C2