cast operation in Squeak
Frank Shearar
frank.shearar at rnid.org.uk
Tue Mar 2 16:31:17 UTC 2004
> >>> "Kwiyi Woo" 03/01/04 02:35 >>>
>
> Hi,
> I want to cast a object to a certain class. How can I do cast
> operation inS
> queak as in other programming language? For example, I can
> do something
> like in java:
>
> String i = (String)str;
>
> I couldn't figure out the syntac for it.
Variables in Squeak have no type, so there's no typecasting necessary. In
other words, if the variable str contains a string, you just write
| i | "This declares i as a variable."
i := str.
to assign str's value to i. The variable declaration section occurs
at the top of the method, like in Pascal.
frank
More information about the Squeak-dev
mailing list
|