protected It's a different method than getters and setters. If you want to call it from outside the class, you can't call it private (you can't call it outside the class), so use "protected" to create a field that only allows access from inside the class and from subclasses. There are three access rights, "public", "protected", and "private". ・ Public: Can be accessed from anywhere · Protected: Only accessible from within that class and its child classes · Private: Only accessible from within that class
Recommended Posts