A simple question: How to copy the instance variables of an object
to another - already existing - object
Rudi Bichler
chaoshierophant at yahoo.com
Sun Jul 31 19:35:36 UTC 2005
Hi,
I need some kind of copyTo: functionality, which copies a complete object (i.e. all instance variables) to another object. I need this to "convert" an object of class A into an object of a subclass of A. Something like:
Object subclass: #MyClass
instanceVariableNames: 'var1 var2' ...
MyClass subclass: #MySubcl
instanceVariableNames: 'var3' ...
MySubcl class >> newCopyFrom: original
"create an object of class MySubcl with is - as MyClass - identical to original"
An example of such a functionality is FormCanvas asBalloonCanvas. This method is implemented by creating a BalloonCanvas and initializing it "by hand". I am looking for a generic way - something like copy in Object. Any idea?
Thanks a lot
Rudi
---------------------------------
Start your day with Yahoo! - make it your home page
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20050731/44db0811/attachment.htm
More information about the Squeak-dev
mailing list
|