G
Gilliam
Hi
I had a problem about java inheritance that I do not know how to solve
in an elegant way.
I have a class named (let say) OriginalClass with a method method
called firstMethod which call secondMethod (also a method of
OriginalClass).
Then I have another class called ExtendedClass which extends the
Original Class. The firstMethod is the same as in the original, so it
is not modified, but the second is different and it is overriden.
The problem is that when calling ExtendClass.firstMethod and it get
executed it calls to OriginalClass.secondMethod instead of the
intended ExtendedClass.secondMethod.
If I just copy the first method into the extended class it will work,
but then I lose the benefits of inheritance.
How could I specify that I want to call the call from my extended
class??
Thanks in advance,
Jorge
I had a problem about java inheritance that I do not know how to solve
in an elegant way.
I have a class named (let say) OriginalClass with a method method
called firstMethod which call secondMethod (also a method of
OriginalClass).
Then I have another class called ExtendedClass which extends the
Original Class. The firstMethod is the same as in the original, so it
is not modified, but the second is different and it is overriden.
The problem is that when calling ExtendClass.firstMethod and it get
executed it calls to OriginalClass.secondMethod instead of the
intended ExtendedClass.secondMethod.
If I just copy the first method into the extended class it will work,
but then I lose the benefits of inheritance.
How could I specify that I want to call the call from my extended
class??
Thanks in advance,
Jorge