class multiple {
static class A {
void foo( B b ) {
System.out.println( "foo called on A B" );
}
void foobarbaz( SubB b ) {
System.out.println( "foo called on A SUB-B" );
}
}
static class SubA extends A {
void foo( B b ) {
System.out.println( "foo called on SUB-A B" );
}
void foobarbaz( SubB b ) {
System.out.println( "foo called on SUB-A SUB-B" );
}
}
static class B { }
static class SubB extends B { }
static public void main( String[] args ) {
A just_a = new A( );
B just_b = new B( );
A sub_a = new SubA( );
B sub_b = new SubB( );
just_a.foo( just_b );
just_a.foo( sub_b );
sub_a.foo( just_b );
sub_a.foo( sub_b );
}
}