From: Robert Klemme Date: 2004-09-02T17:35:27+09:00 Subject: Re: accessing superclass variables "Nicolaj Soendberg Madsen" schrieb im Newsbeitrag news:Pine.GSO.4.58.0409020937480.13526@fire2.cs.aau.dk... Exactly! That was my question. I would still appreciate any effort to explain me how it works :) Note though that the concept of nested class is something completely different from sub class! The general advice is to use accessor methods although you can access them directly. Consider this: class Super attr_accessor :foo class Nested def recommended(super_obj) super_obj.foo end def direct(super_obj) super_obj.instance_variable_get "@foo" end end end class Sub < Super def direct; @foo; end def recommended; foo; end end ?> sub = Sub.new => # >> sub.foo = "bar" => "bar" >> sub.direct => "bar" >> sub.recommended => "bar" >> nest = Super::Nested.new => # >> nest.direct(sub) => "bar" >> nest.recommended(sub) => "bar" On Thu, 2 Sep 2004, Mohammad Khan wrote: > I am not sure what you wanted to know from your question. > > Are you asking > How a variable of super class can be accessed from its sub-class? > > > Thanks > Mohammad > > On Wed, 2004-09-01 at 11:40, Nicolaj Soendberg Madsen wrote: > > How do I access an outer variable from within a nested class? > > > > Is it possible to directly access them? Regards robert