Run ❯
Get your
own PHP
server
❯
Run Code
Ctrl+Alt+R
Change Orientation
Ctrl+Alt+O
Change Theme
Ctrl+Alt+D
Go to Spaces
Ctrl+Alt+P
"; } public function makeSound() { echo "Sound: Meow."; } } class Dog implements Animal { public function fromFamily() { echo "From family: Canidae (Relatives: wolves, foxes, coyotes, jackals, and domestic dogs).
"; } public function makeSound() { echo "Sound: Woff."; } } echo "
Cats
"; $cat = new Cat(); $cat->fromFamily(); $cat->makeSound(); echo "
Dogs
"; $dog = new Dog(); $dog->fromFamily(); $dog->makeSound(); ?>
Cats
From family: Felidae (Relatives: lions, tigers, jaguars, lynx, cougars, and cheetahs).
Sound: Meow.
Dogs
From family: Canidae (Relatives: wolves, foxes, coyotes, jackals, and domestic dogs).
Sound: Woff.