|
From: Samuele P. <pe...@in...> - 2001-04-05 12:07:12
|
Here's a clarifying example (I hope):
<A.java>
public class A {
protected void prot1() {
System.out.println("java prot1");
}
protected void prot2() {
System.out.println("java prot2");
}
public static void invoke_prot2(A a) {
a.prot2();
}
}
</A.java>
<ex.py>
import A
class Apy(A):
def invoke_prot1(self):
self.prot1()
# note: self.super__prot1() won't work because prot1 is not overriden
def invoke_super_prot2(self):
self.super__prot2()
def prot2(self):
print "Apy prot2"
print "-- Apy --"
print dir(Apy) # notice that there's no super__prot1
a=Apy()
a.invoke_prot1()
a.invoke_super_prot2()
a.prot2()
A.invoke_prot2(a)
</ex.py>
You can just try it.
regards.
|