|
how to create an object (of a selection of classes): msg#00106lang.smalltalk.squeak.beginners
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.
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Demystifying "most Smalltalk’s don't directly support multiple inheritance", Klaus D. Witzel |
|---|---|
| Next by Date: | Re: how to create an object (of a selection of classes), Benjamin Schroeder |
| Previous by Thread: | Demystifying "most Smalltalk’s don't directly support multiple inheritance", Klaus D. Witzel |
| Next by Thread: | Re: how to create an object (of a selection of classes), Benjamin Schroeder |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |