Jemoh Posted July 20, 2012 Report Share Posted July 20, 2012 Can someone plz explain to me what is the difference between private, protected & public methods & properties cz I dnt seem to get it. Link to comment Share on other sites More sharing options...
boen_robot Posted July 20, 2012 Report Share Posted July 20, 2012 For properties, it specifies at what point can the value be read or changed, and for methods, at what point can they be executed.Private - only within the class that declared it.Protected - only within the class that declared it, and its children (i.e. classes that extend it, as per this part of the manual).Public - at the class that declared it, its children, and at every instance of the object (or in short: at any point).If that's not enough, you'll have to be a little more specific about what you don't understand (with examples and specific questions like "what would happen in the following scenario: [insert code]"). Link to comment Share on other sites More sharing options...
Ingolme Posted July 21, 2012 Report Share Posted July 21, 2012 I'm sure php.net had it properly explained. http://es.php.net/manual/en/language.oop5.visibility.php Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now