This doesn't work either, because again (Smalltalk at: aClassName) is returning just a ByteString but not (e.g.) Object class or (e.g.) ClassBuilder class .
Lets assume in the calling method is written: returnSuperClass: '#Object'. Note: the Argument must be an instance of String.
returnSuperClass: aClassName |aSuperClass|
aSuperClass := (Smalltalk at: aClassName) superclass.
^ aSuperClass.
Nope, this does'nt work.
Herbert König herbertkoenig@gmx.net wrote: Hello Warakorn,
try: Smalltalk at: #MonthMorph inspect
Cheers
Herbert mailto:herbertkoenig@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.
_______________________________________________ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
--------------------------------- Don't get soaked. Take a quick peak at the forecast with theYahoo! Search weather shortcut.