svn: /phpdoc/es/trunk/language/types/ object.xml

From: Date: Wed, 28 Jul 2010 19:24:20 +0000
Subject: svn: /phpdoc/es/trunk/language/types/ object.xml
Groups: php.doc.es 
Request: Send a blank email to doc-es+get-2995@lists.php.net to get a copy of this message
gerardocdc Wed, 28 Jul 2010 19:24:20 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=301664 Log: Language type Changed paths: A phpdoc/es/trunk/language/types/object.xml Added: phpdoc/es/trunk/language/types/object.xml =================================================================== --- phpdoc/es/trunk/language/types/object.xml (rev 0) +++ phpdoc/es/trunk/language/types/object.xml 2010-07-28 19:24:20 UTC (rev 301664) @@ -0,0 +1,88 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- $Revision: 288721 $ --> +<!-- EN-Revision: 288721 Maintainer: gerardocdc Status: ready --> +<sect1 xml:id="language.types.object"> + <title>Objetos</title> + + <sect2 xml:id="language.types.object.init"> + <title>Inicialización de Objetos</title> + + <para> + Para crear un nuevo <type>object</type>, utilice la declaración <literal>new</literal> + para instanciar una clase: + </para> + + <informalexample> + <programlisting role="php"> +<![CDATA[ +<?php +class foo +{ + function do_foo() + { + echo "Doing foo."; + } +} + +$bar = new foo; +$bar->do_foo(); +?> +]]> + </programlisting> + </informalexample> + + <simpara> + Para una descripción completa, vea el capítulo + <link linkend="language.oop5">Clases y Objetos</link>. + </simpara> + + </sect2> + + <sect2 xml:id="language.types.object.casting"> + <title>Conversión a un objeto</title> + + <para> + Si un <type>object</type> se convierte en un <type>object</type>, éste no se + ve modificado. Si un valor de cualquier otro tipo se convierte en un + <type>object</type>, se crea una nueva instacia de la clase <literal>stdClass</literal> + incorporada. Si el valor es &null;, la nueva instancia estará vacía. Los <type>Array</type>s + se convierten en un <type>object</type> con propiedades nombradas por claves + con sus correspondientes valores. Para cualquier otro valor, una variable miembro + denominada <literal>scalar</literal> contendrá el valor. + </para> + + <informalexample> + <programlisting role="php"> +<![CDATA[ +<?php +$obj = (object) 'ciao'; +echo $obj->scalar; // muestra 'ciao' +?> +]]> + </programlisting> + </informalexample> + + </sect2> +</sect1> + +<!-- Keep this comment at the end of the file +Local variables: +mode: sgml +sgml-omittag:t +sgml-shorttag:t +sgml-minimize-attributes:nil +sgml-always-quote-attributes:t +sgml-indent-step:1 +sgml-indent-data:t +indent-tabs-mode:nil +sgml-parent-document:nil +sgml-default-dtd-file:"~/.phpdoc/manual.ced" +sgml-exposed-tags:nil +sgml-local-catalogs:nil +sgml-local-ecat-files:nil +End: +vim600: syn=xml fen fdm=syntax fdl=2 si +vim: et tw=78 syn=sgml +vi: ts=1 sw=1 +--> +​

« previous php.doc.es (#2995) next »