< ? php
class Employee
{
private $name;
function setName($name)
{
if ($name == “”)
echo “Name cannot be blank!”;
else
$this->name = $name;
}
function getName()
{
return “My name is “.$this->name.;
}
}
class Executive extends Employee
{
function pillageCompany()
{
echo “hi!”;
}
}
$exec = new Executive();
$exec->setName(“Joe”);
echo $exec->getName();
$exec->pillageCompany();
? >
class Employee
{
private $name;
function setName($name)
{
if ($name == “”)
echo “Name cannot be blank!”;
else
$this->name = $name;
}
function getName()
{
return “My name is “.$this->name.;
}
}
class Executive extends Employee
{
function pillageCompany()
{
echo “hi!”;
}
}
$exec = new Executive();
$exec->setName(“Joe”);
echo $exec->getName();
$exec->pillageCompany();
? >
No comments:
Post a Comment
Thank You !