[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Help-smalltalk] Objects and classes

From: Mark Carter
Subject: [Help-smalltalk] Objects and classes
Date: Tue, 27 May 2008 21:24:44 +0100

I'm REALLY new to Smalltalk. In a previous thread, I created a file

Object subclass: #Hello
       instanceVariableNames: ''
       classVariableNames: ''
       poolDictionaries: ''
       category: ''!

"Create a method"
!Hello methodsFor: 'speaking'!
    Transcript show: 'Greetings. '!

! !

To load it, I do
FileStream fileIn: '' !

BUT, if I want to "run" Hello, I have to do
Hello new publish

My question is: why did I have to `new` Hello, whereas I don't have to `new` FileStream? Presumably for Hello I have to create an object by instantiating a class, whereas with a class like FileStream I don't have to. What's going on? Are there methods which only belong to classes and not objects, and if so, how do I define them?

Sorry if the question seems really dumb.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]