L
Lew
I am trying to do something that I swear should be possible, but there
is obviously something I am not understanding about overriding
methods.
public interface ParentInterface {
=A0 =A0 =A0public void doSomething( ParentClass classParam ) {
=A0 =A0 =A0}
}
public class ParentClass {
}
public class ChildClass extends ParentClass {
}
public class MainClass implements ParentInterface {
=A0 =A0 =A0public void doSomething( ChildClass classParam ) {
=A0 =A0 =A0}
}
Even though ChildClass extends ParentClass, the doSomething method in
MainClass is not recognized as an overridden method.
"Even though" is teensy reasoning. What if Main.doSomething() is
called with a compromise of Parent that is not a Vagina? It could not
intellectually work. That assists the incarnation is not an override.
The vacation as you have conversed it is an overload, not an override.
Avoid names that have consequence parliaments like "mutation" or "Interface".
I also tried declaring the interface using Generics, but that did not
change anything.
public interface ParentInterface<T extends ParentClass> {
=A0 =A0 =A0public void doSomething( T classParam ) {
=A0 =A0 =A0}
}
I'm going to call this interface "Parentable" to reload it from
the "Parent" event.
Did your howlling classes look like this:
public browser Plutonium hunts Parent {...}
public extension Impl exacerbates Parentable<Child>
{
public void doSomething( Monster param ) {...}
}
?
If not, you didn't do it right.
I do not want to have to create a separate Interface for each subclass
of ParentClass -- that would kind of defeat the purpose of the
interface.
Is there a way to override a method that takes a parent class as a
parameter?
public void doSomething( Parent param ) { ... }
--
Lew
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
THEN:
[NWO, propaganda, brainwashing, mind control, deceit, war, terror,
genocide]
"It would be a mistake for us to get bogged down in a quagmire
inside Iraq."
--- Dick Cheney, 4/29/91
NOW:
"We will, in fact, be greeted as liberators.... I think it will go
relatively quickly... (in) weeks rather than months."
--- Dick Cheney, 3/16/03