From: "David A. Black" Date: 2009-02-23T23:58:57+09:00 Subject: [ruby-core:22366] Re: Surprising behavior in inheritance Hi -- Nikolai Weibull wrote: > Am I the only one surprised by this behavior? > > class A > def a > puts 'A#a' > end > protected :a > end > > class B< A > def a > puts 'B#a' > end > end > > B.new.a # prints B#a > > I figured that B#a would be protected too. I'm not surprised by it. I figure access level is per method per class, not per method per hierarchy, so your example is what I'd expect. David -- David A. Black / Ruby Power and Light, LLC Ruby/Rails consulting & training: http://www.rubypal.com Coming in 2009: The Well-Grounded Rubyist (http://manning.com/black2) Ruby Training Atlanta! April 1-3, http://www.entp.com/training/atlanta09