3raser Posted February 12, 2012 Share Posted February 12, 2012 I've been meaning to move on to OOP for a while now that I've grasped the concept of OOP in java quite well and I'm doing good so far in PHP OOP. One question that I have floating around though is: When would protected be of any use? I understand what protected does, it's just I don't see how it could ever stop an error from happening. Is there an example for how it would be able to stop an interference from occurring? Quote Link to comment https://forums.phpfreaks.com/topic/256923-question-regarding-protected-in-oop/ Share on other sites More sharing options...
requinix Posted February 12, 2012 Share Posted February 12, 2012 When you don't want external code to have access to something but might want children to. Like "helper" methods or useful variables. Quote Link to comment https://forums.phpfreaks.com/topic/256923-question-regarding-protected-in-oop/#findComment-1317149 Share on other sites More sharing options...
3raser Posted February 12, 2012 Author Share Posted February 12, 2012 When you don't want external code to have access to something but might want children to. Like "helper" methods or useful variables. Alright, thanks for the information. That basically sums up my question. Quote Link to comment https://forums.phpfreaks.com/topic/256923-question-regarding-protected-in-oop/#findComment-1317151 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.