This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
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

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
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:
subject: Inheritance , dynamic binding?
Similar Threads
mughal exam
compilation error...
Why can only "real" dog bark?
Illegal start of expression compilation error