R
robbie.desutter
Hello,
How can I call a method of a base class from a base method whereby the
called method is redefined in a class that extends the base class
To be more concrete, assume the following classes
Class A {
void methodX() {
do_1;
methodY(); // **
}
void methodY() {
do_2;
}
}
Class B extends A {
void methodX() {
super.methodX();
methodY();
}
void methodY() {
do_3;
}
}
If you create an instance of Class B and call methodX on it, do_1 is
executed and next do_3 two times (once called by MethodX of Class A
and once by MethodX of class B). However the first time (line **) I
want to call methodY of class A, in order to get sequence do_1, do_2,
do_3.
Already tried to replace line ** to
((A)this).methodY();
but this doesn't work as the explicit cast to class A of an instance
of class B results in an instance of class B...
How can I solve this problem, preferably without a slow reflection.
Kind regards,
Robbie De Sutter
How can I call a method of a base class from a base method whereby the
called method is redefined in a class that extends the base class
To be more concrete, assume the following classes
Class A {
void methodX() {
do_1;
methodY(); // **
}
void methodY() {
do_2;
}
}
Class B extends A {
void methodX() {
super.methodX();
methodY();
}
void methodY() {
do_3;
}
}
If you create an instance of Class B and call methodX on it, do_1 is
executed and next do_3 two times (once called by MethodX of Class A
and once by MethodX of class B). However the first time (line **) I
want to call methodY of class A, in order to get sequence do_1, do_2,
do_3.
Already tried to replace line ** to
((A)this).methodY();
but this doesn't work as the explicit cast to class A of an instance
of class B results in an instance of class B...
How can I solve this problem, preferably without a slow reflection.
Kind regards,
Robbie De Sutter