// dynamic binding illustrated 

interface I {

	public void f();
	public void g();

} 


class Implementation1 implements I  {

	public void f () { System.out.println ("Impl1's f\n"); }
	public void g () { System.out.println ("Impl1's g\n"); }
}
class Implementation2 implements I  {

	public void f () { System.out.println ("Impl2's f\n"); }
	public void g () { System.out.println ("Impl2's g\n"); }
	public void h () { System.out.println ("Impl2's h\n"); }
}

class SimpleTest {

public static void main (String [] args) {

		I iobj;
		int i;

		i = Integer.parseInt(args[0]);	
		if (i==1) iobj = new Implementation1();
		else iobj = new Implementation2();

		iobj.f();
		iobj.g();
	//	iobj.h();  <--- not allowed 

		Implementation2 i2 = new Implementation2();
		i2.h();
	}

}



