java inheritance
hello,
i'm trying to use a super class called A and a derived class called B.
class A has a method that gets a parameter of type C which is also a super class. class D inherites class C. The code:
class A{
public void foo(C c){...}
}
Class B{
public void foo(D d){...}
}
it gives me a compilation error, how can i make this work?
thanks!!
[406 byte] By [
shdavida] at [2007-11-27 11:24:15]

ok, i made some errors in my first questions, sorry for that:
class A{
public void foo(C c){...}
}
class B extends A{
public void foo(D d){...}
}
and as i said D extends C and the error:
The method foo(D) in the type B is not applicable for the arguments (C)
is a compilation error.
thanks again!!
> The method foo(D) in the type B is not applicable for
> the arguments (C) is a compilation error.
The code you posted compiles just fine. The problem is elsewhere. Time for you to post an SSCCE* that actually demonstrates the compiler error.
*http://mindprod.com/jgloss/sscce.html
> i'm trying to use a super class called A and a derived class called B.
Hopefully, you're using more meaningful names than that. And if you are, you should use those names in the sample code you post here (or at least *something* meaningful).
~