allomov
10/26/2010 - 10:33 AM

access controll differences from other OO languages

access controll differences from other OO languages

puts "Hello World"

class AccessControllTester

  def private_method
    puts 'private_method'
  end

  def protected_method
    puts 'protected_method'
  end

  def public_method
    puts 'public_method'
  end

  def interesting_method(same_class_instance)
    same_class_instance.protected_method
  end
  
  private :private_method
  protected :protected_method

end

act1 = AccessControllTester.new
act1.public_method
act2 = AccessControllTester.new
act2.interesting_method act1