<DIV>&nbsp;</DIV>
<DIV>Cool. That's I was looking for!</DIV>
<DIV>Thanks a lot</DIV>
<DIV>Rudi</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV><BR><BR><B><I>Bert Freudenberg &lt;bert@impara.de&gt;</I></B> wrote:
<BLOCKQUOTE class=replbq style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #1010ff 2px solid"><BR>Am 31.07.2005 um 21:35 schrieb Rudi Bichler:<BR><BR>&gt; Hi,<BR>&gt;<BR>&gt; I need some kind of copyTo: functionality, which copies a complete <BR>&gt; object (i.e. all instance variables) to another object. I need this <BR>&gt; to "convert" an object of class A into an object of a subclass of <BR>&gt; A. Something like:<BR>&gt;<BR>&gt; Object subclass: #MyClass<BR>&gt; instanceVariableNames: 'var1 var2' ...<BR>&gt;<BR>&gt; MyClass subclass: #MySubcl<BR>&gt; instanceVariableNames: 'var3' ...<BR>&gt;<BR>&gt; MySubcl class &gt;&gt; newCopyFrom: original<BR>&gt; "create an object of class MySubcl with is - as MyClass - identical <BR>&gt; to original"<BR>&gt;<BR>&gt; An example of such a functionality is FormCanvas asBalloonCanvas. <BR>&gt; This method is implemented by creating a BalloonCanvas and <BR>&gt; initializing it "by hand". I am looking for a generic way - <BR>&gt;
 something like copy in Object. Any idea?<BR><BR>Looking into the #copy method in Object you'll notice it calls <BR>#shallowCopy, which implements a generic copy of all instance <BR>variables - take a look!<BR><BR>- Bert -<BR><BR><BR></BLOCKQUOTE></DIV><p>
                <hr size=1> <a href="http://us.rd.yahoo.com/evt=34442/*http://www.yahoo.com/r/hs">Start your day with Yahoo! - make it your home page </a>