[Newbies] Matrix with Objetcs

Herbert König herbertkoenig at gmx.net
Wed Oct 28 08:17:23 UTC 2009

Hi Gabriel,

GLT> Hi! this is the first time I use Smalltalk. I created a

welcome to a brand new world!

GLT> class called Celd and I wanted to create a class called Matrix
GLT> which will be a 2D-array of Celd or a Matrix if you prefere.

There is a class Matrix already. And in older Squeaks (3.6) there was
Array2D class.

GLT> Could someone help me with the code?

We need more details.

GLT> I tried this:

GLT> Object subclass: #Matrix
GLT>     instanceVariableNames: 'cells range'
GLT>     classVariableNames: ''
GLT>     poolDictionaries: ''
GLT>     category: 'fiuba-explorador'

GLT> initialize
GLT>     "Inicializa por defecto"
GLT>     cells := Celd new.
GLT>     range := 6

GLT> But when I try to add a Cell... I can't thank you very much in advance.

Which code do you use? And what is the definition of Class Celd?

You need a Collection or one of it's subclasses to implement a matrix.



More information about the Beginners mailing list