<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>protected member </title>
</head>
<body text="#000080" bgcolor="#F0FAFF">
<form method="post" action="protected_1.php">
<select name="auto" size="5">
<option> Path Finder</option>
<option> Explorer</option>
<option> Land Rover</option>
<option> Montero</option>
<option> Lexus</option>
</select>
<br/>
<input type="SUBMIT" value="Submit">
</form>
<?php
class automobile
{
var $name;
protected function auto_type($type)
{
$this->name = $type;
}
}
class SUV extends automobile
{
var $name;
function show_type()
{
echo $this->name, "\tbase is high <br/>";
if($this->name=="Lexus"){echo "Has special traction control feature"; }
}
function __construct($type) { $this->auto_type($type);
}
}
echo " This routine calls a public class SUV that will get info <br>from a
protected member, via a public class <br/>" ;
echo "------<br/>";
if(isset($_REQUEST["auto"])){
$entry = $_POST['auto'];
$suv = new SUV($entry);
$suv->show_type();
}
echo "------";
?>
</body>
</html>