RE: How to change class parent?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

RE: How to change class parent?

Steven Kelly
> How can i change my class's parent on another existing one?

Just change and accept the class definition. E.g. if you have

Smalltalk.MyNameSpace defineClass: #MyClass
        superclass: #{MyNameSpace.OldParent}
        indexedType: #none
        private: false
        instanceVariableNames: 'myInstVar'
        classInstanceVariableNames: ''
        imports: ''
        category: 'MyPackage'

change the second line from OldParent to NewParent:

Smalltalk.MyNameSpace defineClass: #MyClass
        superclass: #{MyNameSpace.NewParent}
        indexedType: #none
        private: false
        instanceVariableNames: 'myInstVar'
        classInstanceVariableNames: ''
        imports: ''
        category: 'MyPackage'

and press Ctrl+S (or choose Accept from the text area's pop-up menu).

The class and all its instances will be migrated automatically.

HTH,
Steve