abstract class Fruit { 
    private $color; 
    
    abstract public function eat(); 
    
    public function setColor($c) { 
        $this->color = $c; 
    } 
} 

class Apple extends Fruit {
    public function eat() {
        echo "Omnomnom";
    }
}

$obj = new Apple();
$obj->eat();
In this example an
interface
would not be able to have method with definition, only method signatures are allowed in interfaces
by Valeri Tandilashvili
4 years ago
PHP
OOP
1
Pro tip: use ```triple backticks around text``` to write in code fences