wood burning stoves 2.0
The moose likes Beginning Java and the fly likes Inheritance , dynamic binding? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Inheritance , dynamic binding?" Watch "Inheritance , dynamic binding?" New topic

Inheritance , dynamic binding?

Zeeman Chen

Joined: Oct 30, 2003
Posts: 9
I cannot understand what's going on behind the code.
the result is
if I hadn't written :
v =d; // upcasting , safe
runtime error since d= (Dog)v; downcasting unsafe.

who can tell me what happend in memory after the following two
thanks in advance!
v= d;
d = (Dog)v;

If a man take no thought at what is distant, he will find sorrow near at hand. ~ Confucius
Layne Lund
Ranch Hand

Joined: Dec 06, 2001
Posts: 3061
One way to see for yourself how things work here is to rename move1(), move2(), and move3() all to move(). Then add some calls to move() from main() like this:

Java API Documentation
The Java Tutorial
I agree. Here's the link: http://aspose.com/file-tools
subject: Inheritance , dynamic binding?
It's not a secret anymore!