<?php
abstract class Humain
{
protected $nom ;
protected $genre ;
public function getNom()
{
return $this->nom ;
}
public function setNom($x)
{
$this->nom = $x ;
}
public function getGenre()
{
return $this->genre ;
}
abstract function travailler() ;
abstract function divertir() ;
}
class Homme extends Humain
{
public function __construction($x)
{
$this->genre = 'M' ;
$this->nom = $x ;
}
public function travailler()
{
echo $this->nom ,' travaille que chef entreprise' ;
}
public function divertir()
{
echo $this->nom ,' va prendre une bierre' ;
}
}
class Femme extends Humain
{
public function __construction($x)
{
$this->genre = 'F' ;
$this->nom = $x ;
}
public function travailler()
{
echo $this->nom ,' travaille en tant que sécrétaire' ;
}
public function divertir()
{
echo $this->nom ,' va faire du shopping entre fille' ;
}
}
$Juliette = new Femme('Juliette') ;
$Alain = new Homme('Alain') ;
echo 'nom: ', $Alain->getNom() '</br>' ;
echo 'genre: ', $Alain->getGenre() ,'</br>' ;
$Alain->travailler() ;
$Alain->divertir() ;
echo '</br>'
echo 'nom: ', $Juliette->getNom() '</br>' ;
echo 'genre: ', $Juliette->getGenre() ,'</br>' ;
$Juliette->travailler() ;
$Juliette->divertir() ;
?>
( ! ) Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ',' or ';' in C:\wamp\www\MaPage.php on line 68