44 lines
996 B
PHP
44 lines
996 B
PHP
![]() |
<?php
|
||
|
|
||
|
Class Etudiant{
|
||
|
|
||
|
private $nom;
|
||
|
private $prenom;
|
||
|
private $age;
|
||
|
|
||
|
public function __construct($nom,$prenom,$age){
|
||
|
$this->nom = $nom;
|
||
|
$this->prenom = $prenom;
|
||
|
$this->age = $age;
|
||
|
}
|
||
|
|
||
|
public function afficherHtml(){
|
||
|
echo "Etudiant2 :<br>". "Nom : ".$this->getNom()."<br>"
|
||
|
."Prenom : ".$this->getPrenom()."<br>"."Age : ".$this->getAge()."<br>";
|
||
|
}
|
||
|
|
||
|
//accès en écriture (setter)
|
||
|
public function setNom($nom){
|
||
|
$this->nom = $nom;
|
||
|
}
|
||
|
|
||
|
public function setPrenom($prenom){
|
||
|
$this->prenom = $prenom;
|
||
|
}
|
||
|
|
||
|
public function setAge($age){
|
||
|
$this->age = $age;
|
||
|
}
|
||
|
|
||
|
public function getNom(){
|
||
|
return $this->nom;
|
||
|
}
|
||
|
|
||
|
public function getPrenom(){
|
||
|
return $this->prenom;
|
||
|
}
|
||
|
|
||
|
public function getAge(){
|
||
|
return $this->age;
|
||
|
}
|
||
|
}
|