Subject: Re: two problems
From: Romain Lorrilliere (romain.lorrilliere@ese.u-psud.fr)
Date: Tue Feb 28 2006 - 17:30:43 CET
Lorrillière Romain
UMR
8079 Laboratoire Ecologie, Systématique et Evolution
Bât.
362
Université
Paris-Sud
91405
Orsay cedex
France
tel : 01 69 15 56 85
fax : 01 69 15 56 96
mobile : 06 81 70 90 70
email : romain.lorrilliere@ese.u-psud.fr
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.