Powered by Ajaxy
Digg StumbleUpon LinkedIn YouTube Flickr Facebook Twitter RSS Reset

Utilisation d’une classe agrégées


{filelink=14113}

<?
class Adresse {
  protected $ville;
  protected $pays;

  public function setVille($ville) { $this->ville = $ville; }
  public function getVille() { return $this->ville; }
  public function setPays($pays) { $this->pays = $pays; }
  public function getPays() { return $this-> pays;}
}

class Employe {
 protected $nom;
 protected $Adresse;

 public function __construct() { $this->Adresse = new Adresse; }
 public function setNom($nom) { $this->nom = $nom; }
 public function getNom() { return $this->nom; }
 public function __call($methode, $arguments) {
  if (methode_exists($this->Adresse, $methode)) {
   return call_user_func_array( array($this->Adresse, $methode), $arguments);
  }
 }
}
?>

No comments yet.

Leave a Comment