class homme
{
var $nom;
var $prenom;
var $age;
function homme()
{
$this->nom = rand(1,100);
$this->prenom= rand(1,100);
$this->age= rand(1,100);
}
}
class joueur extends homme
{
var $defense;
var $milieu;
var $attaque;
function joueur()
{
$this->defense=rand(1,100);
$this->milieu=rand(1,100);
$this->attaque=rand(1,100);
}
function montrerjoueur()
{
echo "$homme->nom|| $this->prenom || $this->age || $this->defense || $this->milieu || $this->attaque <br>";
}
}
$objet=new joueur();
$objet->montrerjoueur();
?>
---------------------------------------------------------------
rezultat dobijen je
|| || || 33 || 12 || 61
kako da zovem variable iz roditeljske klase $nom, $prenom i $age... da li je uopste moguce?
HVALA UNAPRED