DaVinci wrote: > Hello friends. > > I have a rpoblem with object orientation. Intention is to define > instances usable from all classes. For example: > > class Configuration > attr_reader :size > > def initialize(size) > @size = size > end > end > > class Foo > def initialize > puts @conf.size > end > end > > attr_reader :conf > @conf = Configuration.new(100) > Foo.new > > exit(0) > > Why I can not use attr_reader form base class?. Might I use a global > variable to define instance?. > > I need your ideas about "best way of doing it" :) I'm not sure quite what you're aiming for. Perhaps something like this? [Disclaimer: I typed it into email, and haven't run it through Ruby, so beware of typos!] ############### class Configuration attr_reader :size def initialize(size) @size = size end end class Foo < Configuration def initialize super(100) puts size end end Foo.new ############### Kevin