par
djun » 19 févr. 2012, 16:41
J'ai faite des modif:
<?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') ;
$format1 = 'nom : %s' ;
$format2 = 'Genre: %s' ;
echo sprintf($format1, $Alain->getNom()) ;
echo sprintf($format2, $Alain->getGenre()) ;
echo $Alain->travailler() ;
echo $Alain->divertir() ;
echo '</br>'
echo sprintf($format1, $Juliette->getNom()) ;
echo sprintf($format2, $Juliette->getGenre()) ;
echo $Juliette->travailler() ;
echo $Juliette->divertir() ;
?>
erreur: ( ! ) Parse error: syntax error, unexpected T_ECHO, expecting ',' or ';' in C:\wamp\www\MaPage.php on line 76
J'ai faite des modif:
[php] <?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') ;
$format1 = 'nom : %s' ;
$format2 = 'Genre: %s' ;
echo sprintf($format1, $Alain->getNom()) ;
echo sprintf($format2, $Alain->getGenre()) ;
echo $Alain->travailler() ;
echo $Alain->divertir() ;
echo '</br>'
echo sprintf($format1, $Juliette->getNom()) ;
echo sprintf($format2, $Juliette->getGenre()) ;
echo $Juliette->travailler() ;
echo $Juliette->divertir() ;
?>[/php]
erreur: ( ! ) Parse error: syntax error, unexpected T_ECHO, expecting ',' or ';' in C:\wamp\www\MaPage.php on line 76