creating a class at runtime....

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

creating a class at runtime....

nelson -
Can I create a class at Runtime? I want to define a class this way

MyObject class: #newclass

so that myobject MyObject has the class message class: that return a new instance of newclass (but newclass is never devfined before.) I think i can write

class: #aSymbol

^  SuperClass subclass: #newclass   instanceVariableNames: ''

                        classVariableNames: ''

                        poolDictionaries: ''.

that's true?  it gives to me some errors... it seems that newclass can't  receive messages that SuperClass accepts....

thanks for any advice,
  nelson


Reply | Threaded
Open this post in threaded view
|

Re: creating a class at runtime....

nelson -
I have solved....


class: #aSymbol

^  SuperClass subclass: #newclass   instanceVariableNames: ''

                        classVariableNames: ''

                        poolDictionaries: ''.


I missed category:'' in this statement.... But i can't declare a class without  declaring a category?

good day,
  nelson




Reply | Threaded
Open this post in threaded view
|

Re: creating a class at runtime....

Wolfgang Helbig-2
"nelson -" <[hidden email]> wrote:

>
> I have solved....

So did I :-)

I looked at the template the System Browser is providing if you select a
category:

Object subclass: #NameOfSubclass
        instanceVariableNames: ''
        classVariableNames: ''
        poolDictionaries: ''
        category: 'ST80-Editors'

This is a message to be sent to the super class of your new class. (In
the template it happens to be
Object.) The message is implemented in class Class. Consult the System
Browser (Kernel-Classes | Class | subclass creation) for other messages
you might use to create classes.
> I missed category:'' in this statement.... But i can't declare a class without  declaring a category?

Regards,
Wolfgang