[Newbies] How to access a Squeak class

Warakorn Paphrawat warakorn_paphrawat at yahoo.com
Tue Jan 16 13:10:52 UTC 2007


Hi !
Actually it is probably a very simple Squeak concept which I haven't understood, yet.

Serving as an simple example, I would like to write a method, which accepts a Class as argument and which return the Superclass of that Class.
The problem is that the argument must be an instance of String, that means  the argument aClassName  contains an actual class name (e.g. aClassName = 'Object'. or aClassName = 'ClassBuilder'), however, this is just a String object.

returnSuperClass: aClassName
|aSuperClass|

aSuperClass := aClassName superclass.

^ aSuperClass.

Obviously this method won't work, because aClassName is just an instance of ByteString. And instances of ByteString cannot understand the message superclass.

So I need the actual class object  which the content of the String aClassName represents.
How can I achieve ? Or how can I make this method correct ?
(it is imperative, that the argument aClassName is a String).

Thanks for you help in advance.


Best Regards
Warakorn


 
---------------------------------
Have a burning question? Go to Yahoo! Answers and get answers from real people who know.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/beginners/attachments/20070116/f4dff991/attachment.htm


More information about the Beginners mailing list