Quiz · Inheritance and interfaces · lesson 4 of 8
Quiz — an interface and instanceof
Question 1 of 2
What does the program print?
<?php
interface Shape
{
public function area(): float;
}
class Square implements Shape
{
public function area(): float { return 3 ** 2; }
}
$s = new Square();
echo $s instanceof Shape ? 'yes' : 'no', ' ', $s->area(), "\n";