Created
December 3, 2010 02:08
-
-
Save georgemendonca/726466 to your computer and use it in GitHub Desktop.
Encapsulamento de atributos e métodos
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * Encapsulamento de atributos e métodos | |
| * @author george.mendonca | |
| */ | |
| Class Encapsulamento | |
| { | |
| // Visível em todo o script | |
| public $atributoPublico; | |
| // Visível nas classes e subclasses | |
| protected $atributoProtegido; | |
| // Visível apenas na classe | |
| private $atributoPrivado; | |
| public function metodoPublico() | |
| { | |
| // Visível em todos os scripts | |
| } | |
| protected function metodoProtegido() | |
| { | |
| // Visível em classes e subclasses | |
| } | |
| private function metodoPrivado() | |
| { | |
| // Visível apenas na classe | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment