How does inheritance work in codeIgniter MVC model
I have used object oriented m开发者_运维技巧ore in java, where a private member cannot be accessed from outsite the class, protected extending access to child classes, default access extending access to packages and public to every class.
How does this work in PHP when using MVC frameworks( I am using CodeIgniter)? Does it mean all methods in models which I will be accessing from Controllers have to be public?
It means the same thing.
There are no friend classes in php, so you cant break private just because you are using a MVC pattern. Note this is true in Java as well.
This isnt really CI specific... but yes. check out: http://www.php.net/manual/en/language.oop5.visibility.php for more info on php method/property visibility.
精彩评论