OOP in Smalltalk is nearly the same as in Java!
No typecheck
> I could do the same thing this way, right, but this seems more verbose and
> ugly then it has to be.
>
>
>
> (user isKindOf: RSPerson ) ifTrue: [returnPage := (RSPerson
> firstPageForUserClass) ].
> (user isKindOf: RSAdmin ) ifTrue: [returnPage := (RSAdmin
> firstPageForUserClass) ].
> (user isKindOf: RSTeacher ) ifTrue: [returnPage := (RSTeacher
> firstPageForUserClass) ].
> (user isKindOf: RSStudent ) ifTrue: [returnPage := (RSStudent
> firstPageForUserClass) ].
>
> ^returnPage
why don't you either declare a factory or simply define methods on the
RS-Object
> RSPerson >> firstPageForUserClass
^ cccc
> RSAdmin >> firstPageForUserClass
> RSTeacher >> firstPageForUserClass
Stef
_______________________________________________
Pharo-users mailing list
[email protected]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users