An interesting polymorphism behavior/mis-behavior?

Dave, I have some long time confusions about up-casting and down-casting. Could you help clarify?

Like the code below, I have the same variables of three classes (line 1). At line 2, I create a class C object z, then up-cast twice from C to B, then to A. At line 3, I down-cast A back to C.

Question: at this step, I up-cast twice then down-cast back. Over the whole process, how object/handle changes? Handles x/y/z moves back and forth, which I can understand. How about the object itself? which is created only once. The instantiated object actually contains everything along the whole inheritance hierarchy? If a method is non-virtual, it can potentially has multiple copies of the method; if virtual there is only one copy (the last). During up-casting or down-casting, tool will pick the right implementation based on handle type (class) and virtual/non-virtual. Is my understanding correct?

Sorry if my question comes off as naive.

  1.  A x; B y; C z;
    
  2.  z = new(); y = z; x = y;
    
  3.  $cast(z, x); z.showMsg();
    

In reply to dave_59: