class profession
{
var $iam;
function profession($prof)
{
$this->iam = $prof;
}
function set_profession($prof)
{
$this->iam = $prof;
}
function print_profession()
{
echo $this->iam;
}
}
class worker extends profession
{
var $name;
var $age;
function worker($name, $age, $prof)
{
$this->name = $name;
$this->age = $age;
$this->set_profession($prof);
}
function print_all()
{
echo $this->name . " " . $this->age . " ";
echo $this->print_profession();
}
}
$w1 = new worker("dan", 47, "programmer");
$w1->print_all();
/*
run:
dan 47 programmer
*/