Start your All-Access Pass to unlock this challenge
Challenge 1 / 2
Check out the following code:
class Ship
{
private $weaponsCount = 5;
public function getWeaponsCount()
{
return $this->weaponsCount;
}
}
class RebelShip extends Ship
{
public function getWeaponsCount()
{
return parent::getWeaponsCount() + 2;
}
}
$rebelShip = new RebelShip();
print $rebelShip->getWeaponsCount();
How many weapons will the getWeaponsCount()
call return for the $rebelShip
?
Skip challenges and go to theNext Chapter