Michael Borgwardt <> scribbled the following:
> "David McCallum" <> wrote in message news:<>...
>> Michael
>> > What you do instead is call "super.toString()".
>>
>> Thanks for that, that's what I did, problem is with the following methods
>> added, calling Circle.equals recurses.
>>
>> Any clues, I can't see where super would fit in here
> You're making *exactly* the same mistake again:
>> result=result && ((Shape)this).equals((Shape)o);
>> result=(result && this.radius==((Circle)o).radius);
> Please try to understand what I wrote about *why* the problem ocurred.
> As a sidenote: casting "this" *never* makes sense in Java.
Sure it does:
public class Foo {
public static void main(String[] args) {
new Foo().doAllTheStuff();
}
private void doSomething(Object arg) {
System.out.println("Hello");
}
private void doSomething(Foo arg) {
System.out.println("world!");
}
public void doAllTheStuff() {
doSomething((Object)this);
doSomething(this);
}
}
when executed, this class prints out:
Hello
world!
--
/-- Joona Palaste () ---------------------------\
| Kingpriest of "The Flying Lemon Tree" G++ FR FW+ M- #108 D+ ADA N+++|
|
http://www.helsinki.fi/~palaste W++ B OP+ |
\----------------------------------------- Finland rules! ------------/
"Hasta la Vista, Abie!"
- Bart Simpson