View Single Post
Old 04-18-2009, 02:51 PM   #8 (permalink)
allworknoplay
The Gregarious
 
allworknoplay's Avatar
 
Join Date: Feb 2009
Location: New York
Posts: 645
Thanks: 64
allworknoplay is on a distinguished road
Default

Quote:
Originally Posted by Salathe View Post
To access the property directly ($instance->property), yes it needs to be public. Also note that with private, any classes that extend the class will not have access to it. If you want extending classes to be able to 'see' the private property then it will need to instead be protected.
Thanks Salathe,

I think I am a long ways before I write another class extending another class. haha...but I understand.

public - anyone from anywhere can access the property

private - only accessible within the class

protected - only accessible within the class and child classes that have been extended...


And the rules work exactly the same way for methods too? Not just properties....right?
allworknoplay is offline  
Reply With Quote