class WacFrames
attr_reader :wacFrameNav
attr_reader :wacFrameDisp
def initialize()
@wacFrameNav = "nav"
@wacFrameDisp = "disp"
end
end
class WacSubscribers
attr_reader :fr
attr_reader :frame
def initialize()
@fr = WacFrames.new()
@frame = @fr.wacFrameNav
end
end
class WacSubProfile < WacSubscribers
def initialize()
#some code
end
end
end
another = WacSubscribers.new()
puts another.fr #works fine
puts another.frame #works fine
test = WacSubProfile.new()
puts test.fr #error
puts test.frame #error
Thanks
Gennady.
An extra 'end' there but I assume it is just a copy-paste error.
> another = WacSubscribers.new()
> puts another.fr #works fine
> puts another.frame #works fine
>
> test = WacSubProfile.new()
> puts test.fr #error
> puts test.frame #error
This should work fine (you might have problems if you
do not initialize the parent's instance variables by
calling #super but even still the methods should return
nils).
What error is it that you get?
> Thanks
E
--
Posted via http://www.ruby-forum.com/.