Download
<?php
class Employes {
public $fonction;
public $nom;
public $prenom;
public $montant;
function __construct( $fonction, $prenom, $mainName, $montant ) {
$this->fonction = $fonction;
$this->nom = $mainName;
$this->prenom = $prenom;
$this->montant = $montant;
}
function getNomComplet()
{
return "{$this->nom}" . " {$this->prenom}";
}
}
class PrimeEmploye
{
public function primer( $employe )
{
$str = "{$employe->fonction}: ";
$str .= $employe->getNomComplet();
$str .= " ({$employe->montant})";
print $str;
}
}
$employe1 = new Employes( "Agent marketing", "Dick", "Aflack", 1520 );
$promo = new PrimeEmploye();
$promo->primer( $employe1 );
?>