?php / / base class with member properties and methods class Vegetable {var $edible; var $color; function Vegetable ($edible, $color="green ") {$this - edible = $edible; $this - color = $color;} function is_edible() {return $this - edible;} function what_color() {return $this - color;}} / / end of class Vegetable / / extends the base class class Spinach extends Vegetable {var $cooked = false; function Spinach() {$this - Vegetable (true, "green");} function cook_it() {$this - cooked = true;} function is_cooked() {return $this - cooked;}} / / end of class Spinach?
?php / / classe de base, avec ses membres et ses méthodes class Legume {var $mangeable; var $couleur; function legume ($mangeable, $couleur="green ") {$this - mangeable = $mangeable; $this - couleur = $couleur;} function est_mangeable() {return $this - mangeable;} function quelle_couleur() {return $this - couleur;}} / / fin de la classe Legume / / extend la classe de base class Epinard extends Legume {var $cuit = FALSE; function Epinard() {$this - Legume (TRUE, "green");} function cuisine() {$this - cuit = TRUE;} function est_cuit() {return $this - cuit;}} / / fin de la classe Epinard?