Geir Magnusson Jr. wrote:
On Jul 4, 2005, at 4:00 AM, Ben Laurie wrote:
Geir Magnusson Jr. wrote:
On Jul 3, 2005, at 8:25 AM, Ben Laurie wrote:
Joel Neely wrote:
Typed, constrained object references vs. untyped, unconstrained
pointers.
C has typed pointers.
How are they really typed? In Java, I'll get a runtime exception
when I mis-cast... In C, IIRC, I get long hours of debugging...
Cast? Why do you want to do that?
I'll take this as a straight question, although I can actually hear you
saying it and I'm suspicious :)
I actually never understood why I do it other than for readability,
because I do think that the runtime can figure it out.
There's a legitimate use when upcasting to a superclass.
public class Bar {
}
public class Foo extends Bar {
}
Foo f = new Foo();
Bar b = (Bar) foo;
I meant in C (which doesn't have superclasses).
--
>>>ApacheCon Europe<<< http://www.apachecon.com/
http://www.apache-ssl.org/ben.html http://www.thebunker.net/
"There is no limit to what a man can do or how far he can go if he
doesn't mind who gets the credit." - Robert Woodruff