On Sun, 09 Mar 2008 08:58:06 -0700, dkmd_nielsen wrote:

> class A
> end
> 
> class C
>    def initialize
>       x = [A.new,A.new]
>    end
> 
>    def template
>       x
>    end
> end
> 
> Is it possible for an instance of A to determine the instance of C that
> instantiated it?
> 
> The application I'm working on has a class named Template that contains
> an array of Blocks.  What I would like to do is have an instance of
> Block reference back to Template's array so that it can search for a
> particular sibling block in the array.  Is the structure built
> incorrectly?  (It's too late to rebuild at this time.)
> 
> Thanks,
> dvn

class A
  def initialize owner
    @owner=owner
  end
end

class C
  def initialize
    x = [A.new(self),A.new(self)]
  end

  def template
    x
  end
end

-- 
Ken (Chanoch) Bloom. PhD candidate. Linguistic Cognition Laboratory.
Department of Computer Science. Illinois Institute of Technology.
http://www.iit.edu/~kbloom1/