2 Replies Latest reply on Dec 12, 2006 11:18 PM by 807607

    get runtime class and cast object to it?

      public interface Msg 
      Msg msg=msgLib.get(msgType);
      Msg msg2=msg.clone(); //problem! cannot find clone in  x.y.Msg!
      Shouldn't msg be resolved to the implementing class (MsgReply for example) and use the "clone()" method, that i have declared in that class -which overrides the one of Object class?

      If no, is there a way to find the runtime class -probably use "getClass"- and cast to it? How?