<?php abstract class Animal { protected string $name; public function __construct(string $name) { $this->name = $name; } abstract public function speak(); } class Cat extends Animal { public function speak() { echo $this->name . " meows"; } } // However, covariant return types cannot return a more broad type interface AnimalShelter { public function adopt(string $name): Cat; } class CatShelter implements AnimalShelter { public function adopt(string $name): Animal { return new Animal($name); } } $kitty = (new CatShelter)->adopt("Ricky"); $kitty->speak();
You have javascript disabled. You will not be able to edit any code.
Value for `_results` contains invalid data `array`