public function asignarID($id) { if ($this->verificarID($id)) { $this->id = $id; } } protected function asignarTipo($tipo) { $this->tipo = $tipo; } private function verificarID($id) { return is_numeric($id); } } class Iguana extends Animal { function __construct($nombre) { $this->asignarTipo('reptil'); $this->nombre = $nombre; } } $loro = new Animal(1, 'ave'); $loro->nombre = 'silencioso'; // no hay problema $loro->verificarID(); // genera un error, metodo privado $verde = new Iguana('verde'); echo $verde->tipo; // genera un error, propiedad protegida