This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Inheritance , dynamic binding?

 
Zeeman Chen
Greenhorn
Posts: 9
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I cannot understand what's going on behind the code.
the result is
3
MOVE
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
lines?
thanks in advance!
v= d;
d = (Dog)v;


 
Layne Lund
Ranch Hand
Posts: 3061
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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:
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic