When discussing OOP, we must touch the "visibility" topic, meaning the public/private/protected keywords before properties/methods. When to use which?
For example, when creating methods in Controllers, we're probably used to "blindly" type public function ...:
EveryControllerEver.php
public function index(){ // ...} public function create(){ // ...}
Question: in what cases would we change the methods to private or protected?
First, let me tell you...
"protected: property/method can be accessed within the class itself and by inheriting and parent classes but not in their objects" This statement appears to be incorrect. You can't access the protected property of a child from the parent class.