<slide title="PHP5 OO - Protected">

<blurb>
Only accessible/callable by the same, or an inherited class.
Here we see a call to a protected method from the global scope 
being rejected.
</blurb>

<example><![CDATA[<?php
class Bedroom {
	protected $action;

	function __construct() {
		$this->action = 'fun';
	}

	protected function peek() {
		echo $this->action. "\n";
	}
}

class Keyhole extends Bedroom {
	function peek() {
		echo $this->action. "\n";
	}
}

$kh = new Keyhole();
$kh->peek();

$br = new Bedroom();
$br->peek();           /* Doesn't work */
?>]]></example>

<example hide="1" result="1"><![CDATA[fun<br />
Fatal error: Call to protected method Bedroom::peek() from context 'html' in script.php on line 24]]></example>

</slide>
