02.06.2013 Views

Pro PHP and jQuery by Jason Lengstorf.pdf - Computer Science ...

Pro PHP and jQuery by Jason Lengstorf.pdf - Computer Science ...

Pro PHP and jQuery by Jason Lengstorf.pdf - Computer Science ...

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Private <strong>Pro</strong>perties <strong>and</strong> Methods<br />

CHAPTER 3 ■ OBJECT-ORIENTED PROGRAMMING<br />

A property or method declared private is accessible only from within the class that defines it. This<br />

means that even if a new class extends the class that defines a private property, that property or method<br />

will not be available at all within the child class.<br />

To demonstrate this, declare get<strong>Pro</strong>perty() as private in MyClass, <strong>and</strong> attempt to call<br />

call<strong>Pro</strong>tected() from MyOtherClass:<br />

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!