FAQ: Copying a class
Last updated at 5:54 pm UTC on 19 February 2003
Question: How do I copy a class if subclassing is not feasible?
Specifically, define a class (MyNewClass) and evaluate the following in a workspace:
MyNewClass copyAllCategoriesFrom: Old.
MyNewClass class copyAllCategoriesFrom: Old class.
- fileout the original class,
- rename the original class in the image to the new name
- file the original class back in (thus recreating the old class in the image).
- There may still be a few references to the old class in the renamed class, but the references are easily found and changed.