<DIV> </DIV>
<DIV>Cool. That's I was looking for!</DIV>
<DIV>Thanks a lot</DIV>
<DIV>Rudi</DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV><BR><BR><B><I>Bert Freudenberg <bert@impara.de></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>> Hi,<BR>><BR>> I need some kind of copyTo: functionality, which copies a complete <BR>> object (i.e. all instance variables) to another object. I need this <BR>> to "convert" an object of class A into an object of a subclass of <BR>> A. Something like:<BR>><BR>> Object subclass: #MyClass<BR>> instanceVariableNames: 'var1 var2' ...<BR>><BR>> MyClass subclass: #MySubcl<BR>> instanceVariableNames: 'var3' ...<BR>><BR>> MySubcl class >> newCopyFrom: original<BR>> "create an object of class MySubcl with is - as MyClass - identical <BR>> to original"<BR>><BR>> An example of such a functionality is FormCanvas asBalloonCanvas. <BR>> This method is implemented by creating a BalloonCanvas and <BR>> initializing it "by hand". I am looking for a generic way - <BR>>
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>