You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
401 B
20 lines
401 B
<?php
|
|
|
|
//encapsulation le cercle ne donne accès
|
|
//que à ces élément publiques
|
|
class cercle
|
|
{
|
|
public $rayon;
|
|
private $ordonnee;
|
|
private $abcisse;
|
|
function surface()
|
|
{
|
|
return M_PI * $this->rayon * $this->rayon;
|
|
}
|
|
}
|
|
|
|
$cercle3 = new cercle();
|
|
$cercle3->rayon = 3;
|
|
//Attention la ligne ci-dessous produit une erreur
|
|
//$cercle3->abcisse = 22;
|
|
echo $cercle3->surface(); |