Accéder au constructeur de la classe mère

Author:


{filelink=14117}

<?php
class Produit {
  var $nom;

  function Produit( $nom="element", $prix=0) {
    $this->nom = $nom;
    $this->prix = $prix;
  }

  function getNom() {
   return $this->nom;
  }
 }

 class Achat extends Produit {

 }

 $element = new Achat( "Logiciel", 5442 );
 print $element->getNom ();
 ?>

Leave a Reply

Your email address will not be published. Required fields are marked *