Ruby public protected private

public The default setting can be called from outside the class. protected Hide from the outside Can be called with a receiver from the class that defines the method itself and the instance method of that subclass private Hide from the outside Methods that can only be used inside a class and in subclasses Cannot be called by specifying a receiver

Recommended Posts

Ruby public protected private
About private public
private, protected, private permissions-java
Java encapsulation private public