OOP (course 3): Inheritance, Abstract Classes, Interfaces and other amazing things
Override
  Unlock this challenge
Login Register

Challenge 1 / 1

Look at the following classes:

class Ship
{
    public function printType()
    {
        echo 'Empire Ship';

        $this->printMotto();
    }

    public function printMotto()
    {
        echo 'I like to fly!';
    }
}
class RebelShip extends Ship
{
    public function printType()
    {
        echo 'Rebel Ship';
    }
}

What is the result of the following code:

$ship = new Ship();
$rebelShip = new RebelShip();
$ship->printType();
$rebelShip->printType();
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.