/ Published in: PHP
Método setter y getter
Hace mucho tiempo usaba esta manera para tener un solo método que sea getter y setter al mismo tiempo.
Expand |
Embed | Plain Text
<?php class Objeto { private $atributo; public function atributo($value = null) { if(null != $value) { $this->atributo = $value; } return $this->atributo; } }
You need to login to post a comment.
