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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

104<br />

CHAPTER 3 ■ OBJECT-ORIENTED PROGRAMMING<br />

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

When a property or method is declared protected, it can only be accessed within the class itself or in<br />

descendant classes (classes that extend the class containing the protected method).<br />

Declare the get<strong>Pro</strong>perty() method as protected in MyClass <strong>and</strong> try to access it directly from outside<br />

the class:<br />

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

Saved successfully!

Ooh no, something went wrong!