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

Challenge 2 / 3

Look at the following code:

abstract class AbstractShip
{
    private $strength = 0;

    abstract public function getType()
    {
        return 'ship';
    }

    public function setStrength($number)
    {
        $this->strength = $number;
    }

    public function getStrength()
    {
        return $this->strength;
    }
}

class EmpireShip extends AbstractShip
{
    public function getType()
    {
        return 'empire ship';
    }
}

class RebelShip extends AbstractShip
{
}

What error will you see?

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.