[Newbies] Some general questions
Ron at USMedRec.com
Wed May 23 12:59:11 UTC 2007
Chances are you don't want an object called UserFred. What you want instead
is an object with an ivar #name that has the value 'Fred'. Unless Fred is a
unique type of object User that can do things that all other Users can not
or if Fred is not allowed to do some things that all other users are, you
shouldn't think of subclasses as instances of objects. Instances are
identified mostly by their content.
Object subclass: #User
User class >> newForUserNamed: aUserName
"create an instance of User and assign aUserName to the userName
now you can go to a workspace and do this.
User newForUserNamed: 'Fred'.
If you highlight it and inspect it you will get back a user named 'Fred'.
(User class >> means that the method that you write goes on the class you
create called User on the class side [press the class button])
From: Darren White
Is there a way to use a string as the name for a object? For example if I
have the input string 'fred' from a user input field how do I create a
object named userFred or even just fred?
What is the difference between the source file and the image? Does the image
use the code from the source file? If I create code dose it live in the
image or source file?
Is there a way to trigger a save prompt when clicking on the window close
And a question about posting to this list: I notice that the replies to my
last post didn't have 'Re' prefixed to them. How do I reply to a thread. For
my lat post it seems that I accidentally relayed to the thread I had started
by starting a new thread -oops.
More information about the Beginners