[Newbies] how to create an object (of a selection of classes)
Jeroen van Hilst
jeroen at keizerrijk.net
Thu Jun 22 23:07:56 UTC 2006
Best List,
Im very curious to the the 'smalltalk way' to write the following code:
| shape morph |
(2 atRandom == 1)
ifTrue: [shape := RectangleMorph]
ifFalse: [shape := EllipseMorph].
morph := shape new.
I've tried something like:
(#(EllipseMorph RectangleMorph) at: (2 atRandom)) new.
But thats too silly ? Is there some connection to get a class from a symbol
? Or is that the wrong direction ?
Thanks in advance,
- Jeroen - aspiring squeaker.
More information about the Beginners
mailing list