Created
October 26, 2010 10:33
-
-
Save allomov/646672 to your computer and use it in GitHub Desktop.
access controll differences from other OO languages
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
output is:
Hello World
public_method
protected_method