开发者

Is there a smalltalk "toString" equivalent?

For example, let's say I 开发者_JAVA百科am adding a set of objects I created, called myClass (which contains a string) to myList and then I wish to use the list and pass it to a GUI list. Is there a way to populate that GUI list only with the value of that string in myClass?


Every object should respond to printString message with some meaningful string presentation of itself. You can write your own #printString for your object and use it.

Even better for your case could be implementation of asString conversion method, which converts your object to a string.


I believe the methods you are looking for are printString and/or displayString.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜