On 06.01.2009 12:25, David B. wrote:
> Hello everybody,
> 
> I would like to implemente the "Aggregation" - as in
> http://en.wikipedia.org/wiki/Aggregation_(object-oriented_programming) -
> and the "Composition" - as
> http://en.wikipedia.org/wiki/Object_composition. I hope thanks to this
> be able to manage my objects such as my UML model. But I don't exacly
> see the basic Ruby implementation of, and which could be the more sexy
> way.
> 
> Thanks to any suggestions and help.

class Foo

   attr_accessor :aggregate
   attr_reader   :composite

   def initialize
     @composite = Part.new
   end

end

f = Foo.new
a = AnotherClass.new
f.aggregate = a

Cheers

	robert

-- 
remember.guy do |as, often| as.you_can - without end