OOP (course 3): Inheritance, Abstract Classes, Interfaces and other amazing things
Protected Visibility
  Start your All-Access Pass to unlock this challenge
Buy Access Login

Challenge 1 / 1

Check out the following code:

// Ship.php

class Ship
{
    public $name;

    protected $weaponPower;

    private $defense;

    public function getDefense()
    {
        return $this->defense;
    }
}
// JediShip.php

class JediShip extends Ship
{
    public function getWeaponPower()
    {
        return $this->weaponPower;
    }
}
// index.php

$jediShip = new JediShip();
$jediShip->name;
$jediShip->weaponPower;

Which of the above code will give us an error?

Skip challenges and go to theNext Chapter

Turn Challenges Off?

All further challenges will be skipped automatically.
You can re-enable challenges at any time on this page or from your account page.