Ruby: Access Control

intro

  • public : accessible both outside and inside class
  • protected & private : only accessible inside class itself and its subclasses
  • protected : can be called with an explicit receiver
  • private : can only called by implicit self

你可能感兴趣的:(Ruby: Access Control)