note 30526 added to language.oop
| From: | rsantos at gelre dot com dot br | Date: | Fri, 21 Mar 2003 00:05:12 +0000 |
| Subject: | note 30526 added to language.oop | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-45580@lists.php.net to get a copy of this message | ||
/*
Pais: Brasil
Data: 20/03/2003
autor: Rodrigo Rodrigues
email: rsantos@gelre.com.br
Descrição: Herança no Php
*/
class pai { // Class pai
var $nome;
function setNome($newNome) { // Função Set
$this->nome = $newNome;
}
function getNome() { // Função Get
return $this->nome;
}
}
class filho extends pai { // Extends to class pai
function filho($valorNome) { // Construtor
return pai::setNome($valorNome);
}
}
$autor = "Rodrigo Rodrigues";
$obj = new filho($autor);
echo ($obj->getNome());
--
http://www.php.net/manual/en/language.oop.php
http://master.php.net/manage/user-notes.php?action=edit+30526
http://master.php.net/manage/user-notes.php?action=delete+30526
http://master.php.net/manage/user-notes.php?action=reject+30526