September 12, 2004
I think we discussed this before.
it's not cleary documented.
it's not how java does it.

the following will compile and run.
the method that gets called is the method in A.

#########
class A
{
	public void foo()
	{
		printf("A.foo \n" );
	}
}

class B : A
{
	private void foo()
	{
		printf("B.foo\n" );
	}
}

void main()
{
	A a = new B();
	a.foo();
}

#########
outputs:
A.foo
#########
if the method B.foo is public the output is
B.foo
#########

#########################################################
now we add class C
and the result is clearly... strange

class A
{
	public void foo()
	{
		printf("A.foo \n" );
	}
}

class B : A
{
	private void foo()
	{
		printf("B.foo\n" );
	}
}

class C : B
{
	public void foo()
	{
		super.foo();
		printf("C.foo \n" );
	}
}

void main()
{
	A a = new C();
	a.foo();
}

##############
outputs:
B.foo
C.foo
##############


Ant