Guest User

Untitled

a guest
Jun 19th, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. puts "Hello World"
  2.  
  3. class AccessControllTester
  4.  
  5. def private_method
  6. puts 'private_method'
  7. end
  8.  
  9. def protected_method
  10. puts 'protected_method'
  11. end
  12.  
  13. def public_method
  14. puts 'public_method'
  15. end
  16.  
  17. def interesting_method(same_class_instance)
  18. same_class_instance.protected_method
  19. end
  20.  
  21. private :private_method
  22. protected :protected_method
  23.  
  24. end
  25.  
  26. act1 = AccessControllTester.new
  27. act1.public_method
  28. act2 = AccessControllTester.new
  29. act2.interesting_method act1
Add Comment
Please, Sign In to add comment