protected member variable : protected « Class « PHP
- PHP
- Class
- protected
protected member variable
<?php
class Staff
{
protected $name;
protected $title;
function __construct()
{
echo "<p>Staff constructor called!</p>";
}
}
class Manager extends Staff
{
function __construct()
{
parent::__construct();
echo "<p>Manager constructor called!</p>";
}
}
$employee = new Manager();
?>
Related examples in the same category