Skip to content

Instantly share code, notes, and snippets.

@allomov
Created October 26, 2010 10:33
Show Gist options
  • Save allomov/646672 to your computer and use it in GitHub Desktop.
Save allomov/646672 to your computer and use it in GitHub Desktop.
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
@allomov
Copy link
Author

allomov commented Oct 26, 2010

output is:
Hello World
public_method
protected_method

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment