11.09.2018 Views

Aprender a desarrollar un sitio Web con PHP y MySQL

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

métodos públicos<br />

public f<strong>un</strong>ction comer ()<br />

{<br />

...<br />

}<br />

{<br />

}<br />

public f<strong>un</strong>ction moverse ()<br />

...<br />

}<br />

?><br />

Estos métodos se activan automáticamente si el atributo es privado o no existe. Almacenan el valor en la<br />

tabla $tab_atributos, y en el índice, el nombre del atributo. El<br />

método__isset($atributo) permite saber si existe el atributo.<br />

La página uso.php:<br />

<br />

Da como resultado:<br />

Llamada al <strong>con</strong>structor.<br />

El atributo color no existe.<br />

__set<br />

__get<br />

Negro<br />

El atributo peso existe.<br />

www.FreeLibros.me

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!