[Newbies] How to access a Squeak class

Herbert König herbertkoenig at gmx.net
Tue Jan 16 13:16:46 UTC 2007


Hello Warakorn,

try:
Smalltalk at: #MonthMorph inspect

Cheers

Herbert       mailto:herbertkoenig at gmx.net
WP> Hi !
WP> Actually it is probably a very simple Squeak concept which I haven't understood, yet.

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

WP> returnSuperClass: aClassName
WP> |aSuperClass|

WP> aSuperClass := aClassName superclass.

WP> ^ aSuperClass.

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

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

WP> Thanks for you help in advance.


WP> Best Regards
WP> Warakorn



WP> Have a burning question? Go to Yahoo! Answers and get answers from real people who know.






More information about the Beginners mailing list