links to this page:    
View this PageEdit this PageUploads to this PageHistory of this PageTop of the SwikiRecent ChangesSearch the SwikiHelp Guide
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?


First possibility:

Use ClassDescription>>copyAllCategoriesFrom:.

Specifically, define a class (MyNewClass) and evaluate the following in a workspace:

MyNewClass copyAllCategoriesFrom: Old.
MyNewClass class copyAllCategoriesFrom: Old class.

Second possibility:
  1. fileout the original class,
  2. rename the original class in the image to the new name
  3. file the original class back in (thus recreating the old class in the image).
  4. There may still be a few references to the old class in the renamed class, but the references are easily found and changed.