W
Will Clark
I have a class such as:
class A
{
public void methodA()
{
// does general stuff and also:
methodB();
}
public void methodB()
{
// Does something non-descript!
}
}
and another class that is a subclass of this, for example:
class B extends A
{
public void methodA()
{
// Does stuff and then...
super.methodA();
}
public void methodB()
{
// Does something or other and then...
methodA();
}
}
Now if I were to create an instance of class B and call methodB on it, such
as in the following fragment:
B obj;
obj.methodB();
I would like it to run, in the following order:
B.methodB()
B.methodA()
A.methodA()
A.methodB()
end then stop! But it doesn't because instead A.methodA() goes and calls
B.methodB() not A.methodB() and the whole thing sits in a loop.
Is there any way of indicating to Java that A.methodA() calls A.methodB()
and NOT the inherited version of it?
Cheers for your help!
Will
class A
{
public void methodA()
{
// does general stuff and also:
methodB();
}
public void methodB()
{
// Does something non-descript!
}
}
and another class that is a subclass of this, for example:
class B extends A
{
public void methodA()
{
// Does stuff and then...
super.methodA();
}
public void methodB()
{
// Does something or other and then...
methodA();
}
}
Now if I were to create an instance of class B and call methodB on it, such
as in the following fragment:
B obj;
obj.methodB();
I would like it to run, in the following order:
B.methodB()
B.methodA()
A.methodA()
A.methodB()
end then stop! But it doesn't because instead A.methodA() goes and calls
B.methodB() not A.methodB() and the whole thing sits in a loop.
Is there any way of indicating to Java that A.methodA() calls A.methodB()
and NOT the inherited version of it?
Cheers for your help!
Will