PHP Class Inheritance
<?php interface AnimalInterface { public function makeSound(); } class Dog implements AnimalInterface { public function makeSound() { echo "Woof! <br />"; } } class Cat implements AnimalInterface { public function makeSound() { echo "Meow! <br />"; } } $myObj1 = new Dog(); $myObj1-> makeSound(); $myObj2 = new Cat(); $myObj2->makeSound(); ?>
by Gabriel Jakhveladze
2 years ago
PHP
Object Oriented PHP Tutorial
0
Pro tip: use ```triple backticks around text``` to write in code fences