Possible Duplicate:
Is there any way to forbid the son class to call the public method of super class in java?
some days ago, when I develop the plugin for hudson(a Continue integrate tool), I met the this
problem . I created the class which extends the SubversionSCM(the offical class). I just
wanted to override the public method of super class, then call super's public method back like
example. but the compile gave error.I don't konw why, how could it do?
the real situation is like following example.
public abstract class TObject{
abstract public void quark();
}
public class Animal extends TObject{
public void quark(){
System.out.println("this is the animal");
}
}
public class Dog extends Animal{
@overide
public void quark(){
System.out.println("this is the animal");
**super.quark();**
}
}
In this example, The Dog call the super.quark(); in it's quark method.
But I don't want the Dog could call super.quark();the Animal class is written by
others, so can't be changed.....
anyone who can help me?