Messages from list : cormas@cirad.fr

Choose a topic among the following archives :

Re: two problems

New Message Reply Date view Thread view Subject view Author view

Subject: Re: two problems
From: Cesar Rabak (cesar.rabak@gmail.com)
Date: Tue Feb 28 2006 - 16:22:41 CET

Romain Lorrilliere escreveu:
> Dear colleagues,
[snipped]

I cannot understand where is the polymorphism here.

> The second it's a problem of polymorphism.*
> When I want use the polymorphism for apply a method to all instances, my
> model can't to do. The super class didn't now the instances of the both
> specialized class, and I must have made methods to do that:
>
> "---------------"
> /
> updateTurtleNat
>
> |turtlNat|
> turtleNat := OrderedCollection new.
> turtleNat := self index: self theTurtleNatFemales in: turtleNat.
> turtleNat := self index: self theTurtleNatMales in: turtleNat.
>
> self theTurtleNats: turtleNat./
On the other hand, perhaps you could use a more simple construct for
method above:

If I understand you intent, you want to put all the members of 'self
theTurtleNatFemales' and 'self theTurtleNatMales' into 'turtleNat'.

Try this and get rid of 'index:':

turtleNat addAll: self theTurtleNatFemales.
turtleNat addAll: self theTurtleNatMales.

Hope this helps.

-- 
Cesar Rabak
GNU/Linux User 52247.
Get counted: http://counter.li.org/

New Message Reply Date view Thread view Subject view Author view
 

Back to home