<?php interface Animal { } class Dog implements Animal { } class Pet { public function __construct(Animal $animal) { } public function getName() { echo get_class($this); } } class RescuePet extends Pet { public function __construct(Dog $animal) { } } $f = new RescuePet(new Dog()); $f->getName();
You have javascript disabled. You will not be able to edit any code.