<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>

<channel>
	<title>blog.qui-mera.net</title>
	<atom:link href="http://www.blog.qui-mera.net/?feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://www.blog.qui-mera.net</link>
	<description>blog de programacion, sitio de rodolfo cordero sancho</description>
	<pubDate>Sun, 01 Feb 2009 21:37:59 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.2</generator>
	<language>en</language>
			<item>
		<title>Introducción a  InnerClass en Java II</title>
		<link>http://www.blog.qui-mera.net/?p=72</link>
		<comments>http://www.blog.qui-mera.net/?p=72#comments</comments>
		<pubDate>Sun, 01 Feb 2009 21:37:59 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[java]]></category>

		<guid isPermaLink="false">http://www.blog.qui-mera.net/?p=72</guid>
		<description><![CDATA[Introducción 
En un post anterior tratamos lo que son las clases internas y definimos el uso mas común que se le puede dar a una clase interna, en este post trataremos el uso de una clase interna dentro de una interfaz y como instan ciarla fuera de la clase contenedora y la herencia de la [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Introducción </strong></p>
<p>En un post anterior tratamos lo que son las clases internas y definimos el uso mas común que se le puede dar a una clase interna, en este post trataremos el uso de una clase interna dentro de una interfaz y como instan ciarla fuera de la clase contenedora y la herencia de la clase contenedora y se puede “sobrescribir” una clase interna.</p>
<p><span id="more-72"></span></p>
<p><strong>Alcance de las InnerClass</strong></p>
<p>Como ya hemos visto las clases internas poseen grandes ventajas, como hemos visto las clases internas pueden ser declaradas  como privadas, protegidas y publicas, al igual que los métodos las clases privadas solo son accesibles dentro de la clase, las privadas. A manera de referencia  si se declara una clase interna como privada esta no podrá ser instanciada fuera de la clase, si es declarada como protected solo es accesible dentro del package  de la clase contenedora y permite ser rescrita si la clase contenedora se le extiende además de ser instanciable en los hijos que hereden de la clase contenedora,   en caso de  accesible en todo parte del programa; y puede ser instanciada fuera de la clase contenedora.</p>
<p><strong>Instancias de  una clase interna fuera de la clase contenedora</strong></p>
<p>Primero que todo existen dos maneras para instanciar explícitamente una clase interna, cada una tiene una ventaja y desventaja que definiremos más adelante. Para ambas soluciones la clase interna no puede estar contenida dentro de un método (obviamente se darán cuenta que la vida util de la clase no permite realizar la instancia explicita) y segundo la clase interna tiene que ser declara como publica. El código quedaría algo como así</p>

<div class="wp_syntax"><div class="code"><pre class="java java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">package</span> <span style="color: #006699;">innerclasstwo</span>;
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> Main <span style="color: #009900;">&#123;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> InternalClass
    <span style="color: #009900;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #003399;">String</span> label;
        <span style="color: #000000; font-weight: bold;">public</span> InternalClass<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> label<span style="color: #009900;">&#41;</span>
        <span style="color: #009900;">&#123;</span>
            <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">label</span><span style="color: #339933;">=</span>label;
        <span style="color: #009900;">&#125;</span>
        <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> printLabel<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
        <span style="color: #009900;">&#123;</span>
  Main.<span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">printLabel</span><span style="color: #009900;">&#40;</span>label<span style="color: #009900;">&#41;</span>;
         <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000066; font-weight: bold;">void</span> printLabel<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> label<span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
         <span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span>label<span style="color: #009900;">&#41;</span>;
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000066; font-weight: bold;">void</span> main<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> args<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        Main test<span style="color: #339933;">=</span><span style="color: #000000; font-weight: bold;">new</span> Main<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
        Main.<span style="color: #006633;">InternalClass</span> internal<span style="color: #339933;">=</span>  test.<span style="color: #000000; font-weight: bold;">new</span> InternalClass<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;hola mundo!!!&quot;</span><span style="color: #009900;">&#41;</span>;
        internal.<span style="color: #006633;">printLabel</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Nótese la instrucción <em>“test.new InternalClass(String label);”</em> como ven el new queda detrás de un punto y la instancia de Main, cabe notar que la clase tiene que ser instancia da por medio de una instancia de la clase contenedora, la clase interna tiene acceso a los métodos de la clase contenedora, esta es la ventaja primordial de esta solución</p>
<p>La otra solución es definir la clase como estática esto permitirá instan ciarla sin la necesidad de una instancia de la clase contenedora, pero para esto la clase interna declarada como final no tiene acceso a los métodos de la clase contenedora, Un miembro estático no puede referenciar a un elemento no estático. Pero en cambio no necesitaremos de un objeto para construir la clase interna. Un ejemplo seria algo asi</p>

<div class="wp_syntax"><div class="code"><pre class="java java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">package</span> <span style="color: #006699;">innerclasstwo</span>;
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> Main <span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">public</span>  <span style="color: #000000; font-weight: bold;">static</span>  <span style="color: #000000; font-weight: bold;">class</span> InternalClassFinal
    <span style="color: #009900;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #003399;">String</span> label;
        <span style="color: #000000; font-weight: bold;">public</span> InternalClassFinal<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> label<span style="color: #009900;">&#41;</span>
        <span style="color: #009900;">&#123;</span>
            <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">label</span><span style="color: #339933;">=</span>label;
        <span style="color: #009900;">&#125;</span>
        <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> printLabel<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
        <span style="color: #009900;">&#123;</span>
           <span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">label</span><span style="color: #009900;">&#41;</span>;
        <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000066; font-weight: bold;">void</span> printLabel<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> label<span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
         <span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span>label<span style="color: #009900;">&#41;</span>;
    <span style="color: #009900;">&#125;</span>
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000066; font-weight: bold;">void</span> main<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> args<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                Main.<span style="color: #006633;">InternalClassFinal</span> internalTwo<span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Main.<span style="color: #006633;">InternalClassFinal</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;hola mundo&quot;</span><span style="color: #009900;">&#41;</span>;
         internalTwo.<span style="color: #006633;">printLabel</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>El uso de new es similar al usado con los packages, en este punto es diferente con el ejemplo anterior.</p>
<p>La desventaja de declarar la clase como final es que no se pueden acceder a ninguna propiedad o método de la clase contenedora aunque también sea estática no puede ser accedida por la clase interna, pero es independiente y puede ser instanciada sin una instancia de la clase contenedora</p>
<p>El primer método  (<em>NombreDelaClase instancia= nombredelobjeto.new ClaseInterna ()</em>) se debe tener una instancia de la clase contenedora para realizar la instancia de la clase interna aunque podríamos declarar un objeto anónimo y hacer una instancia como de la siguiente manera</p>

<div class="wp_syntax"><div class="code"><pre class="java java" style="font-family:monospace;">Main.<span style="color: #006633;">InternalClass</span> testThree<span style="color: #339933;">=</span><span style="color: #000000; font-weight: bold;">new</span> Main<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #000000; font-weight: bold;">new</span> InternalClass<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot; Hola Mundo&quot;</span><span style="color: #009900;">&#41;</span>;</pre></div></div>

<p>Nótese que podríamos anidar clases internas (clases internas dentro de clases internas) y esta forma se vuelve engorrosa de analizar en caso de error o de modificación de código</p>
<p><strong>Clases Internas dentro de una Interfaz o/y Clase Abstractas</strong></p>
<p>Como conocerán las interfaces solo contienen la declaración de métodos y no el cuerpo de ellos, en el caso de incluir clases internas podemos desarrollar el cuerpo de una clase. Esto nos dará tres nuevas oportunidades, una es crear instancias de la interfase haciendo responsable a la clase interna,  que la clase interna implemente la interfaz contenedora, o que esta sea un elemento “heredado” de la clase interna a las clases que la implementen. Para el siguiente ejemplo vamos a hacer una interfaz que nos permita probar las tres alternativas planteadas</p>
<p>En el apartado anterior notamos como instanciar clases internas  explícitamente, como ya se imaginaran es posible construir clases internas dentro de interfaces y clases abstractas, obligatoriamente estas clases internas para ser instancia das. Una clase interna dentro de una interfase no puede ser declarada como protected o prívate, ya que en concepto todos los elementos de una interfaz son publicas</p>
<p>El código de la interfase a probar seria algo así</p>

<div class="wp_syntax"><div class="code"><pre class="java java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">interface</span> <span style="color: #000000; font-weight: bold;">Interface</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> SayHello<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
&nbsp;
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000000; font-weight: bold;">class</span> FirstClass
    <span style="color: #009900;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">Interface</span> getInstance<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
        <span style="color: #009900;">&#123;</span>
            <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #000000; font-weight: bold;">Interface</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
            <span style="color: #009900;">&#123;</span>
                <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> SayHello<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                    <span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;hello i am a inner class&quot;</span><span style="color: #009900;">&#41;</span>;
                <span style="color: #009900;">&#125;</span>
&nbsp;
            <span style="color: #009900;">&#125;</span>;
        <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000000; font-weight: bold;">class</span> SecondClass <span style="color: #000000; font-weight: bold;">implements</span> <span style="color: #000000; font-weight: bold;">Interface</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> SayHello<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
           <span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Hello i am  another inner Class&quot;</span><span style="color: #009900;">&#41;</span>;
        <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> ThirdClass
    <span style="color: #009900;">&#123;</span>
&nbsp;
        <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> SayAnotherHello<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
        <span style="color: #009900;">&#123;</span>
            <span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Hello i am  a simple inner class&quot;</span><span style="color: #009900;">&#41;</span>;
        <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">abstract</span> <span style="color: #000000; font-weight: bold;">class</span> FourClass
    <span style="color: #009900;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">abstract</span> <span style="color: #000066; font-weight: bold;">void</span> SayAnotherHello<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
&nbsp;
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>FirstClass es una clase que retornara una instancia de Interface, SecondClass implementa la interfaz contenedora, ThirdClass es simplemente una clase publica y FourClass es una clase abstracta.</p>
<p>Ahora el main del ejemplo instanciando a FirstClass y SecondClass seria algo asi</p>

<div class="wp_syntax"><div class="code"><pre class="java java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> Main
<span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000066; font-weight: bold;">void</span> main<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> args<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">Interface</span> inter<span style="color: #339933;">=</span><span style="color: #000000; font-weight: bold;">new</span> <span style="color: #000000; font-weight: bold;">Interface</span>.<span style="color: #006633;">FirstClass</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">getInstance</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
        inter.<span style="color: #006633;">SayHello</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
        <span style="color: #000000; font-weight: bold;">Interface</span> interTwo<span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span>  <span style="color: #000000; font-weight: bold;">Interface</span>.<span style="color: #006633;">SecondClass</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
        interTwo.<span style="color: #006633;">SayHello</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
&nbsp;
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Claro esta si intentamos realizar una instancia de ThirdClass usando una instancia de FirstClass o SecondClass directamente, el codigo seria algo asi</p>

<div class="wp_syntax"><div class="code"><pre class="java java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">Interface</span>.<span style="color: #006633;">ThirdClass</span> innerClassFromInterface<span style="color: #339933;">=</span><span style="color: #000000; font-weight: bold;">new</span> <span style="color: #000000; font-weight: bold;">Interface</span>.<span style="color: #006633;">SecondClass</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #000000; font-weight: bold;">new</span> ThirdClass<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> ;</pre></div></div>

<p>Pero como Interface es una interfase y no un objecto el compilador nos dará el siguiente error</p>
<p><em>“source code - qualified new of static class”</em></p>
<p>Entonces acceder a una clase interna no estática de una interfaz no puede ser instanciada, se deberá usar una clase que implemente la internas para tener acceso a esta clase interna, inclusive la clase internas y estáticas  declaradas dentro de la internas pueden hacer instancias de ThirdClass sin ningún problema, como ejemplo usaremos SecondClass y le incluiremos en método SayHello() una instancia de ThirdClass</p>

<div class="wp_syntax"><div class="code"><pre class="java java" style="font-family:monospace;">  <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000000; font-weight: bold;">class</span> SecondClass <span style="color: #000000; font-weight: bold;">implements</span> <span style="color: #000000; font-weight: bold;">Interface</span>
  <span style="color: #009900;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> SayHello<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
        <span style="color: #009900;">&#123;</span>
           ThirdClass test<span style="color: #339933;">=</span><span style="color: #000000; font-weight: bold;">new</span> ThirdClass<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
           test.<span style="color: #006633;">SayAnotherHello</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
           <span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Hello i am  another inner Class&quot;</span><span style="color: #009900;">&#41;</span>;
        <span style="color: #009900;">&#125;</span>
  <span style="color: #009900;">&#125;</span></pre></div></div>

<p>Aun podemos hacer una prueba en una clase externa que implemente la clase abstracta (FourClass) y haga una instancia de ThirdClass</p>

<div class="wp_syntax"><div class="code"><pre class="java java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> ClassAndInterface <span style="color: #000000; font-weight: bold;">implements</span> <span style="color: #000000; font-weight: bold;">Interface</span> <span style="color: #009900;">&#123;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> SayHello<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        ThirdClass cla<span style="color: #339933;">=</span><span style="color: #000000; font-weight: bold;">new</span> ThirdClass<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
        cla.<span style="color: #006633;">SayAnotherHello</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
&nbsp;
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> SaySecondHello<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">new</span>  FourClass<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
        <span style="color: #009900;">&#123;</span>
            @Override
            <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> SayAnotherHello<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
               <span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;I am  a inner AbstractClass&quot;</span><span style="color: #009900;">&#41;</span>;
            <span style="color: #009900;">&#125;</span>
&nbsp;
        <span style="color: #009900;">&#125;</span>.<span style="color: #006633;">SayAnotherHello</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">public</span> FourClass getAbstractClass<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #000000; font-weight: bold;">new</span>  FourClass<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
        <span style="color: #009900;">&#123;</span>
            @Override
            <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> SayAnotherHello<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
               <span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;I am  a inner AbstractClass&quot;</span><span style="color: #009900;">&#41;</span>;
            <span style="color: #009900;">&#125;</span>
&nbsp;
        <span style="color: #009900;">&#125;</span>;
    <span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Y a manera de prueba podemos incluir esta líneas en el main</p>

<div class="wp_syntax"><div class="code"><pre class="java java" style="font-family:monospace;">        ClassAndInterface classAndInterface<span style="color: #339933;">=</span><span style="color: #000000; font-weight: bold;">new</span> ClassAndInterface<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
        classAndInterface.<span style="color: #006633;">SayHello</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
        <span style="color: #000000; font-weight: bold;">Interface</span>.<span style="color: #006633;">FourClass</span> abstractInnerClass <span style="color: #339933;">=</span>classAndInterface.<span style="color: #006633;">getAbstractClass</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
        abstractInnerClass.<span style="color: #006633;">SayAnotherHello</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;</pre></div></div>

<p>Las clases abstractas no se diferencian mucho a las interfaces, con respecto a lo que hemos estado hablando, pero la unica diferencia notable es que podemos hacer una instancia de una clase interna usando otra clase interna estática en otras palabras el compilador no nos dirá que es código incompilable, por ejemplo veamos esta clase abstracta usando el ejemplo anterior (SecondClass y ThirdClass)</p>

<div class="wp_syntax"><div class="code"><pre class="java java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">abstract</span> <span style="color: #000000; font-weight: bold;">class</span> AbstractClass <span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">abstract</span> <span style="color: #000066; font-weight: bold;">void</span> SayHello<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000000; font-weight: bold;">class</span> SecondClass <span style="color: #000000; font-weight: bold;">extends</span> AbstractClass
    <span style="color: #009900;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> SayHello<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
        <span style="color: #009900;">&#123;</span>
           ThirdClass test<span style="color: #339933;">=</span><span style="color: #000000; font-weight: bold;">new</span> ThirdClass<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
           test.<span style="color: #006633;">SayAnotherHello</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
           <span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Hello i am  another abstract Class&quot;</span><span style="color: #009900;">&#41;</span>;
&nbsp;
        <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> ThirdClass
    <span style="color: #009900;">&#123;</span>
&nbsp;
        <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> SayAnotherHello<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
        <span style="color: #009900;">&#123;</span>
            <span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Hello i am  a simple abstract  class&quot;</span><span style="color: #009900;">&#41;</span>;
        <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Podemos hacer una instancia de ThirdClass de forma reducida y explicita, en forma resumida será así la instancia:</p>

<div class="wp_syntax"><div class="code"><pre class="java java" style="font-family:monospace;">AbstractClass.<span style="color: #006633;">ThirdClass</span> innerClassFromInterface<span style="color: #339933;">=</span><span style="color: #000000; font-weight: bold;">new</span> AbstractClass.<span style="color: #006633;">SecondClass</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #000000; font-weight: bold;">new</span> ThirdClass<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> ;
&nbsp;
innerClassFromInterface.<span style="color: #006633;">SayAnotherHello</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;</pre></div></div>

<p>En futuro y ultimo post trataremos Herencia de una clase contenedora</p>
<p><a title="codigo de ejemplo" href="http://www.blog.qui-mera.net/descargas/Introduccion%20a%20InnerClass%20II.rar" target="_blank">codigo de ejemplo</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.blog.qui-mera.net/?feed=rss2&amp;p=72</wfw:commentRss>
		</item>
		<item>
		<title>Introducción a  InnerClass en Java I</title>
		<link>http://www.blog.qui-mera.net/?p=64</link>
		<comments>http://www.blog.qui-mera.net/?p=64#comments</comments>
		<pubDate>Mon, 26 Jan 2009 01:25:43 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[java]]></category>

		<guid isPermaLink="false">http://www.blog.qui-mera.net/?p=64</guid>
		<description><![CDATA[Introducción
Una de las características más interesantes de java son las clases internas.  Una de los principios de la OOP (Programación Orientada a Objetos) es  el concepto de “caja negra”, el cual define que la implementación debe estar oculta y controlada para  un “cliente” (entiéndase como otra aplicación, una clase, una persona etc.).
Como habrán de saber [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Introducción</strong><br />
Una de las características más interesantes de java son las clases internas.  Una de los principios de la OOP (Programación Orientada a Objetos) es  el concepto de “caja negra”, el cual define que la implementación debe estar oculta y controlada para  un “cliente” (entiéndase como otra aplicación, una clase, una persona etc.).<br />
Como habrán de saber dentro de una clase normal podemos declarar métodos, propiedades y atributos privados para evitar el acceso a terceros, en algunos lenguajes permiten contener clases.<br />
Estas clases tienen acceso a las propiedades y métodos de su clase contenedora es “casi” (ojo las comillas) a una herencia.</p>
<p>En este post trataremos estos temas<br />
Clases Internas<br />
Clases internas dentro de un método<br />
Clases anónimas</p>
<p><span id="more-64"></span></p>
<p><strong>Clases Internas</strong></p>

<div class="wp_syntax"><div class="code"><pre class="java java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">package</span> <span style="color: #006699;">innerclasstest</span>;
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> Main <span style="color: #009900;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000000; font-weight: bold;">class</span> MyInnerClass
	<span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #003399;">String</span> label;
&nbsp;
		<span style="color: #000000; font-weight: bold;">public</span> MyInnerClass<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> label<span style="color: #009900;">&#41;</span>
		<span style="color: #009900;">&#123;</span>
			<span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">label</span><span style="color: #339933;">=</span>label;
		<span style="color: #009900;">&#125;</span>
		<span style="color: #000000; font-weight: bold;">public</span> MyInnerClass<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
		<span style="color: #009900;">&#123;</span>
			<span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">label</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;Soy un constructor sin parametros :(&quot;</span>;
&nbsp;
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> printLabel<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
		<span style="color: #009900;">&#123;</span>
			<span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">label</span><span style="color: #009900;">&#41;</span>;
		<span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #000000; font-weight: bold;">public</span> Main<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		MyInnerClass uno<span style="color: #339933;">=</span><span style="color: #000000; font-weight: bold;">new</span> MyInnerClass<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Soy un constructor con parametros&quot;</span><span style="color: #009900;">&#41;</span>;
		MyInnerClass dos<span style="color: #339933;">=</span><span style="color: #000000; font-weight: bold;">new</span> MyInnerClass<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
		uno.<span style="color: #006633;">printLabel</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
		dos.<span style="color: #006633;">printLabel</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
&nbsp;
	<span style="color: #009900;">&#125;</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000066; font-weight: bold;">void</span> main<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> args<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		Main test<span style="color: #339933;">=</span><span style="color: #000000; font-weight: bold;">new</span> Main<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
&nbsp;
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>En el ejemplo anterior notamos tres puntos importates.<br />
La clase interna (MyInnerClass) se declara exactamente como cualquier otra clase<br />
Se instancia como cualquier otra clase dentro de la clase contenedora.<br />
Puede declararse como privada, publica o protegida.</p>
<p>Como se ha mencionado puede llamar a los elementos de la clase contenedora aunque sean declarados como privados, para hacer la llamada tenemos que hacerlo de la siguiente manera: <em>NombredelaClaseContenedora.<strong>this</strong>.nombreMetodoOPropiedad</em>.<br />
Seria algo como asi,</p>

<div class="wp_syntax"><div class="code"><pre class="java java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">package</span> <span style="color: #006699;">innerclasstest</span>;
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> Main <span style="color: #009900;">&#123;</span>
	<span style="color: #666666; font-style: italic;">/*Clase Interna*/</span>
	<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000000; font-weight: bold;">class</span> MyInnerClass
	<span style="color: #009900;">&#123;</span>
&nbsp;
        		<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> callToCall<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> parametro<span style="color: #009900;">&#41;</span>
        		<span style="color: #009900;">&#123;</span>
           		          Main.<span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">call</span><span style="color: #009900;">&#40;</span>parametro<span style="color: #009900;">&#41;</span>;<span style="color: #666666; font-style: italic;">/*OJO la llamada*/</span>
            <span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #666666; font-style: italic;">/*Fin de la clase Interna*/</span>
 <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000066; font-weight: bold;">void</span> call<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> parametro<span style="color: #009900;">&#41;</span>
    	<span style="color: #009900;">&#123;</span>
        		<span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span>parametro<span style="color: #009900;">&#41;</span>;
<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">public</span> Main<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
MyInnerClass test<span style="color: #339933;">=</span><span style="color: #000000; font-weight: bold;">new</span> MyInnerClass<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
            uno.<span style="color: #006633;">callToCall</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Estoy Llamando un metodo de la clase contenedora&quot;</span><span style="color: #009900;">&#41;</span>;
<span style="color: #009900;">&#125;</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000066; font-weight: bold;">void</span> main<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> args<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		Main test<span style="color: #339933;">=</span><span style="color: #000000; font-weight: bold;">new</span> Main<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
&nbsp;
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Como vemos call(String parametro) es privado pero es facilmente llamado por la clase interna</p>
<p><strong>Clases internas dentro de un método</strong></p>
<p>Como hemos visto una clase puede contener una clase, pero dentro de java podemos declarar una clase dentro de una método, en este ciclo de vida de la clase depende de la ejecución del método, o en todo caso dependerá de cuanto dure el bloque donde estara declarada la clase, antes o después del bloque la clase no existe por ende no puede ser instanciada, un ejemplo seria algo asi</p>

<div class="wp_syntax"><div class="code"><pre class="java java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">package</span> <span style="color: #006699;">innerclasstest</span>;
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> Main <span style="color: #009900;">&#123;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> ContrustruirUnaClase<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">class</span> Metodo
        <span style="color: #009900;">&#123;</span>
            <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> print<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;hola mundo&quot;</span><span style="color: #009900;">&#41;</span>;<span style="color: #009900;">&#125;</span>;
        <span style="color: #009900;">&#125;</span>
        <span style="color: #000000; font-weight: bold;">new</span> Metodo<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">print</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
    <span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">public</span> Main<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">ContrustruirUnaClase</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
	<span style="color: #009900;">&#125;</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000066; font-weight: bold;">void</span> main<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> args<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		Main test<span style="color: #339933;">=</span><span style="color: #000000; font-weight: bold;">new</span> Main<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
&nbsp;
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Aunque seria un uso poco común el anterior ejemplo, y la verdad no tendría sentido, el uso mas común de contener una clase dentro de un método seria retornar una instancia de esta clase. Para esto necesitamos que nuestra clase interna herede una clase (ya sea abstracta o sencilla) o implemente una interfaz.  El codigo de la interfaz y la clase abstracta seria algo como así.</p>

<div class="wp_syntax"><div class="code"><pre class="java java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">abstract</span> <span style="color: #000000; font-weight: bold;">class</span>  AbstractClass <span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">protected</span> <span style="color: #000066; font-weight: bold;">int</span> res<span style="color: #339933;">=</span>0;
&nbsp;
    <span style="color: #000000; font-weight: bold;">public</span>  <span style="color: #000000; font-weight: bold;">abstract</span> <span style="color: #000066; font-weight: bold;">void</span> addToSum<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> b<span style="color: #009900;">&#41;</span>;
&nbsp;
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">int</span> getRes<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">return</span> res;
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Y el de la interfaz</p>

<div class="wp_syntax"><div class="code"><pre class="java java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">interface</span> IInterface <span style="color: #009900;">&#123;</span>
&nbsp;
    <span style="color: #000066; font-weight: bold;">int</span> Sum<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> b,<span style="color: #000066; font-weight: bold;">int</span> c<span style="color: #009900;">&#41;</span>;
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Ahora veamos como seria la implementación y una prueba,  cabe destacar que este tipo de implementación facilita el patrón de fabrica abstracta</p>

<div class="wp_syntax"><div class="code"><pre class="java java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">package</span> <span style="color: #006699;">innerclasstest</span>;
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> Main <span style="color: #009900;">&#123;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">public</span> IInterface getInstance<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">class</span> test <span style="color: #000000; font-weight: bold;">implements</span> IInterface
        <span style="color: #009900;">&#123;</span>
            <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">int</span> Sum<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> b, <span style="color: #000066; font-weight: bold;">int</span> c<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                <span style="color: #000000; font-weight: bold;">return</span> b<span style="color: #339933;">+</span>c;
            <span style="color: #009900;">&#125;</span>
        <span style="color: #009900;">&#125;</span>
        <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #000000; font-weight: bold;">new</span> test<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">public</span> AbstractClass getInstanceAbstract<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">class</span> test <span style="color: #000000; font-weight: bold;">extends</span> AbstractClass
        <span style="color: #009900;">&#123;</span>
&nbsp;
            @Override
            <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> addToSum<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> b<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                <span style="color: #000000; font-weight: bold;">super</span>.<span style="color: #006633;">res</span><span style="color: #339933;">+=</span>b;
            <span style="color: #009900;">&#125;</span>
&nbsp;
        <span style="color: #009900;">&#125;</span>
        <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #000000; font-weight: bold;">new</span> test<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
    <span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000066; font-weight: bold;">void</span> main<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> args<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		Main test<span style="color: #339933;">=</span><span style="color: #000000; font-weight: bold;">new</span> Main<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
       		<span style="color: #000000; font-weight: bold;">Interface</span> test2<span style="color: #339933;">=</span>test.<span style="color: #006633;">getInstance</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
         	<span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span>test2.<span style="color: #006633;">Sum</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">3</span>, <span style="color: #cc66cc;">5</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>;
        	AbstractClass test3<span style="color: #339933;">=</span>test.<span style="color: #006633;">getInstanceAbstract</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
            test3.<span style="color: #006633;">addToSum</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">5</span><span style="color: #009900;">&#41;</span>;
            test3.<span style="color: #006633;">addToSum</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">10</span><span style="color: #009900;">&#41;</span>;
            test3.<span style="color: #006633;">addToSum</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">11</span><span style="color: #009900;">&#41;</span>;
            <span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span>test3.<span style="color: #006633;">getRes</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>;
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p><strong>Clases anónimas</strong></p>
<p>Como hemos visto las clases internas tiene  una utilidad bastante evidente, sobre todo en la capacidad que tienen de ocultar código, a las programadores que usan la herramienta NetBeans notaran que cuando este genera un JFrame genera un main y dentro del main incluye unas lineas parecidas a esta</p>

<div class="wp_syntax"><div class="code"><pre class="java java" style="font-family:monospace;">  java.<span style="color: #006633;">awt</span>.<span style="color: #003399;">EventQueue</span>.<span style="color: #006633;">invokeLater</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">Runnable</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> run<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                <span style="color: #000000; font-weight: bold;">new</span> NewJFrame<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">setVisible</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span>;
            <span style="color: #009900;">&#125;</span>
        <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>;</pre></div></div>

<p>Como vemos este realiza un new Runnable(), pero Runnable es una interfaz y aparte de esto desarrolla un cuerpo e implementa el método run(), en java se permite este tipo de instrucciones lo cual esta clase que implementa Runnable se le conoce como una clase anónima, la cual  no posee un nombre, pero se sabe que implementa o extiende de una interfaz o una clase, por lo cual se le puede hacer un upcasting. Ahora del ejemplo  del subtema anterior usaremos la clase abstracta AbstractClass  y la interfaz  IInterface, Ahora retornaremos  usando una clase anónima dentro de la estructura de los métodos</p>

<div class="wp_syntax"><div class="code"><pre class="java java" style="font-family:monospace;"> <span style="color: #000000; font-weight: bold;">package</span> <span style="color: #006699;">innerclasstest</span>;
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> Main <span style="color: #009900;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">public</span> AbstractClass getInstanceAbstractTwo<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #000000; font-weight: bold;">new</span> AbstractClass<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
&nbsp;
            @Override
            <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> addToSum<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> b<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
               <span style="color: #000000; font-weight: bold;">super</span>.<span style="color: #006633;">res</span><span style="color: #339933;">+=</span>b;
            <span style="color: #009900;">&#125;</span>
        <span style="color: #009900;">&#125;</span>;
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">public</span> IInterface getInstanceTwo<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #000000; font-weight: bold;">new</span> IInterface<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
        <span style="color: #009900;">&#123;</span>
            <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">int</span> Sum<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> b, <span style="color: #000066; font-weight: bold;">int</span> c<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                <span style="color: #000000; font-weight: bold;">return</span> b<span style="color: #339933;">+</span>c;
            <span style="color: #009900;">&#125;</span>
        <span style="color: #009900;">&#125;</span>;
    <span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000066; font-weight: bold;">void</span> main<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> args<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		Main test<span style="color: #339933;">=</span><span style="color: #000000; font-weight: bold;">new</span> Main<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
&nbsp;
        AbstractClass test4<span style="color: #339933;">=</span>test.<span style="color: #006633;">getInstanceAbstractTwo</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
        test4.<span style="color: #006633;">addToSum</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">10</span><span style="color: #009900;">&#41;</span>;
        test4.<span style="color: #006633;">addToSum</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">11</span><span style="color: #009900;">&#41;</span>;
        test4.<span style="color: #006633;">addToSum</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">12</span><span style="color: #009900;">&#41;</span>;
        <span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span>test4.<span style="color: #006633;">getRes</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>;
&nbsp;
        IInterface test5<span style="color: #339933;">=</span>test.<span style="color: #006633;">getInstanceTwo</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
        <span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span>test5.<span style="color: #006633;">Sum</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">10</span>, <span style="color: #cc66cc;">21</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>;
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Como vemos es una manera abreviada de retornar una clase implementada en el cuerpo de un método. Una desventaja de este método es que  al no tener una clase con un nombre el compilador no permitirá sobrecargar el constructor vacio, para esto deberemos declarar un bloque sin nombre y definir los parámetros en el metodo contenedor como final, ya que los parámetros tienen que existir para ser llamados en el bloque vació. Por inconveniente el constructor no puede ser sobrecargado y no puede existir más de un constructor. Un ejemplo seria esto.</p>

<div class="wp_syntax"><div class="code"><pre class="java java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">package</span> <span style="color: #006699;">innerclasstest</span>;
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> Main <span style="color: #009900;">&#123;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">public</span> IInterface getInstanceTwo<span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">final</span> <span style="color: #000066; font-weight: bold;">int</span> b,<span style="color: #000000; font-weight: bold;">final</span> <span style="color: #000066; font-weight: bold;">int</span> c<span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #000000; font-weight: bold;">new</span> IInterface<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
        <span style="color: #009900;">&#123;</span>
            <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000066; font-weight: bold;">int</span> k;
            <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000066; font-weight: bold;">int</span> l;
            <span style="color: #009900;">&#123;</span>
                <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">k</span><span style="color: #339933;">=</span>b;
                <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">l</span><span style="color: #339933;">=</span>c;
            <span style="color: #009900;">&#125;</span>
&nbsp;
            <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">int</span> Sum<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> b, <span style="color: #000066; font-weight: bold;">int</span> c<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                <span style="color: #000000; font-weight: bold;">return</span> k<span style="color: #339933;">+</span>l<span style="color: #339933;">+</span>c<span style="color: #339933;">+</span>b;
            <span style="color: #009900;">&#125;</span>
&nbsp;
        <span style="color: #009900;">&#125;</span>;
    <span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">public</span> Main<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000066; font-weight: bold;">void</span> main<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> args<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
Main test<span style="color: #339933;">=</span><span style="color: #000000; font-weight: bold;">new</span> Main<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
           IInterface test6<span style="color: #339933;">=</span>test.<span style="color: #006633;">getInstanceTwo</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">10</span>, <span style="color: #cc66cc;">20</span><span style="color: #009900;">&#41;</span>;
           <span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span>test6.<span style="color: #006633;">Sum</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">10</span>, <span style="color: #cc66cc;">21</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>;
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>En un futuro post trataremos instanciar clases internas en otras clases y clases internas dentro de clases abstractas e interfaces.</p>
<p><a title="codigo" href="http://www.blog.qui-mera.net/descargas/InnerClassTest.rar" target="_blank">codigo de ejemplo</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.blog.qui-mera.net/?feed=rss2&amp;p=64</wfw:commentRss>
		</item>
		<item>
		<title>I-Manejo de Eventos en C# (Clases Delegadas)</title>
		<link>http://www.blog.qui-mera.net/?p=42</link>
		<comments>http://www.blog.qui-mera.net/?p=42#comments</comments>
		<pubDate>Wed, 10 Dec 2008 01:08:00 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[.Net]]></category>

		<category><![CDATA[c#]]></category>

		<guid isPermaLink="false">http://www.blog.qui-mera.net/?p=42</guid>
		<description><![CDATA[Introducción

En nuestras aplicaciones a veces necesitamos que al realizar una acción (sea un clic sobre un botón, o al cargar una pagina Web) se ejecute una parte del código de la aplicación de manera transparente. Este primer tutorial de eventos vamos a tratar el tema de Delegados en .net como parte del manejo de eventos.

En [...]]]></description>
			<content:encoded><![CDATA[<p class="MsoNormal"><strong>Introducción</strong></p>
<p class="MsoNormal">
<p class="MsoNormal">En nuestras aplicaciones a veces necesitamos que al realizar una acción (sea un clic sobre un botón, o al cargar una pagina Web)<span> </span>se<span> </span>ejecute una parte del código de la aplicación de manera transparente. Este primer tutorial de eventos vamos a tratar el tema de Delegados en .net como parte del manejo de eventos.</p>
<p class="MsoNormal"><span id="more-42"></span></p>
<p class="MsoNormal">En .net el manejo de eventos se realiza por medio de la definición de un tipo especial de<span> </span>subclase que se le conoce como delegado. Estas clases pueden contener referencias de uno o más métodos de tal manera que a través del objeto sea posible solicitar ejecución en cadena de todos ellos.</p>
<p class="MsoNormal"><strong>Delegados </strong></p>
<p class="MsoNormal" style="text-align: justify;">Es<span> </span>un tipo especial de subclase (<strong>System.MulticastDelegate)</strong>. Sin embargo, para definir estas clases no se puede utilizar el mecanismo de herencia normal, este tendrá una sintaxis especial. Estas clases especiales contienen métodos y propiedades de otros objetos, y permiten hacer colecciones de estos métodos.</p>
<p class="MsoNormal" style="text-align: justify;"><!--[if gte mso 9]><xml> <w:WordDocument> <w:View>Normal</w:View> <w:Zoom>0</w:Zoom> <w:TrackMoves /> <w:TrackFormatting /> <w:HyphenationZone>21</w:HyphenationZone> <w:PunctuationKerning /> <w:ValidateAgainstSchemas /> <w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid> <w:IgnoreMixedContent>false</w:IgnoreMixedContent> <w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText> <w:DoNotPromoteQF /> <w:LidThemeOther>ES-CR</w:LidThemeOther> <w:LidThemeAsian>X-NONE</w:LidThemeAsian> <w:LidThemeComplexScript>X-NONE</w:LidThemeComplexScript> <w:Compatibility> <w:BreakWrappedTables /> <w:SnapToGridInCell /> <w:WrapTextWithPunct /> <w:UseAsianBreakRules /> <w:DontGrowAutofit /> <w:SplitPgBreakAndParaMark /> <w:DontVertAlignCellWithSp /> <w:DontBreakConstrainedForcedTables /> <w:DontVertAlignInTxbx /> <w:Word11KerningPairs /> <w:CachedColBalance /> </w:Compatibility> <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel> <m:mathPr> <m:mathFont m:val="Cambria Math" /> <m:brkBin m:val="before" /> <m:brkBinSub m:val=" " /> <m:smallFrac m:val="off" /> <m:dispDef /> <m:lMargin m:val="0" /> <m:rMargin m:val="0" /> <m:defJc m:val="centerGroup" /> <m:wrapIndent m:val="1440" /> <m:intLim m:val="subSup" /> <m:naryLim m:val="undOvr" /> </m:mathPr></w:WordDocument> </xml><![endif]--><!--[if gte mso 9]><xml> <w:LatentStyles DefLockedState="false" DefUnhideWhenUsed="true"   DefSemiHidden="true" DefQFormat="false" DefPriority="99"   LatentStyleCount="267"> <w:LsdException Locked="false" Priority="0" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="Normal" /> <w:LsdException Locked="false" Priority="9" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="heading 1" /> <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 2" /> <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 3" /> <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 4" /> <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 5" /> <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 6" /> <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 7" /> <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 8" /> <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 9" /> <w:LsdException Locked="false" Priority="39" Name="toc 1" /> <w:LsdException Locked="false" Priority="39" Name="toc 2" /> <w:LsdException Locked="false" Priority="39" Name="toc 3" /> <w:LsdException Locked="false" Priority="39" Name="toc 4" /> <w:LsdException Locked="false" Priority="39" Name="toc 5" /> <w:LsdException Locked="false" Priority="39" Name="toc 6" /> <w:LsdException Locked="false" Priority="39" Name="toc 7" /> <w:LsdException Locked="false" Priority="39" Name="toc 8" /> <w:LsdException Locked="false" Priority="39" Name="toc 9" /> <w:LsdException Locked="false" Priority="35" QFormat="true" Name="caption" /> <w:LsdException Locked="false" Priority="10" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="Title" /> <w:LsdException Locked="false" Priority="1" Name="Default Paragraph Font" /> <w:LsdException Locked="false" Priority="11" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="Subtitle" /> <w:LsdException Locked="false" Priority="22" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="Strong" /> <w:LsdException Locked="false" Priority="20" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="Emphasis" /> <w:LsdException Locked="false" Priority="59" SemiHidden="false"    UnhideWhenUsed="false" Name="Table Grid" /> <w:LsdException Locked="false" UnhideWhenUsed="false" Name="Placeholder Text" /> <w:LsdException Locked="false" Priority="1" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="No Spacing" /> <w:LsdException Locked="false" Priority="60" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Shading" /> <w:LsdException Locked="false" Priority="61" SemiHidden="false"    UnhideWhenUsed="false" Name="Light List" /> <w:LsdException Locked="false" Priority="62" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Grid" /> <w:LsdException Locked="false" Priority="63" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 1" /> <w:LsdException Locked="false" Priority="64" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 2" /> <w:LsdException Locked="false" Priority="65" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 1" /> <w:LsdException Locked="false" Priority="66" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 2" /> <w:LsdException Locked="false" Priority="67" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 1" /> <w:LsdException Locked="false" Priority="68" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 2" /> <w:LsdException Locked="false" Priority="69" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 3" /> <w:LsdException Locked="false" Priority="70" SemiHidden="false"    UnhideWhenUsed="false" Name="Dark List" /> <w:LsdException Locked="false" Priority="71" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Shading" /> <w:LsdException Locked="false" Priority="72" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful List" /> <w:LsdException Locked="false" Priority="73" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Grid" /> <w:LsdException Locked="false" Priority="60" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Shading Accent 1" /> <w:LsdException Locked="false" Priority="61" SemiHidden="false"    UnhideWhenUsed="false" Name="Light List Accent 1" /> <w:LsdException Locked="false" Priority="62" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Grid Accent 1" /> <w:LsdException Locked="false" Priority="63" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 1 Accent 1" /> <w:LsdException Locked="false" Priority="64" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 2 Accent 1" /> <w:LsdException Locked="false" Priority="65" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 1 Accent 1" /> <w:LsdException Locked="false" UnhideWhenUsed="false" Name="Revision" /> <w:LsdException Locked="false" Priority="34" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="List Paragraph" /> <w:LsdException Locked="false" Priority="29" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="Quote" /> <w:LsdException Locked="false" Priority="30" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="Intense Quote" /> <w:LsdException Locked="false" Priority="66" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 2 Accent 1" /> <w:LsdException Locked="false" Priority="67" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 1 Accent 1" /> <w:LsdException Locked="false" Priority="68" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 2 Accent 1" /> <w:LsdException Locked="false" Priority="69" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 3 Accent 1" /> <w:LsdException Locked="false" Priority="70" SemiHidden="false"    UnhideWhenUsed="false" Name="Dark List Accent 1" /> <w:LsdException Locked="false" Priority="71" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Shading Accent 1" /> <w:LsdException Locked="false" Priority="72" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful List Accent 1" /> <w:LsdException Locked="false" Priority="73" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Grid Accent 1" /> <w:LsdException Locked="false" Priority="60" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Shading Accent 2" /> <w:LsdException Locked="false" Priority="61" SemiHidden="false"    UnhideWhenUsed="false" Name="Light List Accent 2" /> <w:LsdException Locked="false" Priority="62" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Grid Accent 2" /> <w:LsdException Locked="false" Priority="63" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 1 Accent 2" /> <w:LsdException Locked="false" Priority="64" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 2 Accent 2" /> <w:LsdException Locked="false" Priority="65" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 1 Accent 2" /> <w:LsdException Locked="false" Priority="66" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 2 Accent 2" /> <w:LsdException Locked="false" Priority="67" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 1 Accent 2" /> <w:LsdException Locked="false" Priority="68" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 2 Accent 2" /> <w:LsdException Locked="false" Priority="69" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 3 Accent 2" /> <w:LsdException Locked="false" Priority="70" SemiHidden="false"    UnhideWhenUsed="false" Name="Dark List Accent 2" /> <w:LsdException Locked="false" Priority="71" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Shading Accent 2" /> <w:LsdException Locked="false" Priority="72" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful List Accent 2" /> <w:LsdException Locked="false" Priority="73" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Grid Accent 2" /> <w:LsdException Locked="false" Priority="60" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Shading Accent 3" /> <w:LsdException Locked="false" Priority="61" SemiHidden="false"    UnhideWhenUsed="false" Name="Light List Accent 3" /> <w:LsdException Locked="false" Priority="62" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Grid Accent 3" /> <w:LsdException Locked="false" Priority="63" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 1 Accent 3" /> <w:LsdException Locked="false" Priority="64" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 2 Accent 3" /> <w:LsdException Locked="false" Priority="65" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 1 Accent 3" /> <w:LsdException Locked="false" Priority="66" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 2 Accent 3" /> <w:LsdException Locked="false" Priority="67" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 1 Accent 3" /> <w:LsdException Locked="false" Priority="68" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 2 Accent 3" /> <w:LsdException Locked="false" Priority="69" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 3 Accent 3" /> <w:LsdException Locked="false" Priority="70" SemiHidden="false"    UnhideWhenUsed="false" Name="Dark List Accent 3" /> <w:LsdException Locked="false" Priority="71" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Shading Accent 3" /> <w:LsdException Locked="false" Priority="72" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful List Accent 3" /> <w:LsdException Locked="false" Priority="73" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Grid Accent 3" /> <w:LsdException Locked="false" Priority="60" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Shading Accent 4" /> <w:LsdException Locked="false" Priority="61" SemiHidden="false"    UnhideWhenUsed="false" Name="Light List Accent 4" /> <w:LsdException Locked="false" Priority="62" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Grid Accent 4" /> <w:LsdException Locked="false" Priority="63" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 1 Accent 4" /> <w:LsdException Locked="false" Priority="64" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 2 Accent 4" /> <w:LsdException Locked="false" Priority="65" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 1 Accent 4" /> <w:LsdException Locked="false" Priority="66" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 2 Accent 4" /> <w:LsdException Locked="false" Priority="67" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 1 Accent 4" /> <w:LsdException Locked="false" Priority="68" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 2 Accent 4" /> <w:LsdException Locked="false" Priority="69" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 3 Accent 4" /> <w:LsdException Locked="false" Priority="70" SemiHidden="false"    UnhideWhenUsed="false" Name="Dark List Accent 4" /> <w:LsdException Locked="false" Priority="71" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Shading Accent 4" /> <w:LsdException Locked="false" Priority="72" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful List Accent 4" /> <w:LsdException Locked="false" Priority="73" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Grid Accent 4" /> <w:LsdException Locked="false" Priority="60" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Shading Accent 5" /> <w:LsdException Locked="false" Priority="61" SemiHidden="false"    UnhideWhenUsed="false" Name="Light List Accent 5" /> <w:LsdException Locked="false" Priority="62" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Grid Accent 5" /> <w:LsdException Locked="false" Priority="63" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 1 Accent 5" /> <w:LsdException Locked="false" Priority="64" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 2 Accent 5" /> <w:LsdException Locked="false" Priority="65" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 1 Accent 5" /> <w:LsdException Locked="false" Priority="66" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 2 Accent 5" /> <w:LsdException Locked="false" Priority="67" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 1 Accent 5" /> <w:LsdException Locked="false" Priority="68" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 2 Accent 5" /> <w:LsdException Locked="false" Priority="69" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 3 Accent 5" /> <w:LsdException Locked="false" Priority="70" SemiHidden="false"    UnhideWhenUsed="false" Name="Dark List Accent 5" /> <w:LsdException Locked="false" Priority="71" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Shading Accent 5" /> <w:LsdException Locked="false" Priority="72" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful List Accent 5" /> <w:LsdException Locked="false" Priority="73" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Grid Accent 5" /> <w:LsdException Locked="false" Priority="60" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Shading Accent 6" /> <w:LsdException Locked="false" Priority="61" SemiHidden="false"    UnhideWhenUsed="false" Name="Light List Accent 6" /> <w:LsdException Locked="false" Priority="62" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Grid Accent 6" /> <w:LsdException Locked="false" Priority="63" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 1 Accent 6" /> <w:LsdException Locked="false" Priority="64" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 2 Accent 6" /> <w:LsdException Locked="false" Priority="65" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 1 Accent 6" /> <w:LsdException Locked="false" Priority="66" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 2 Accent 6" /> <w:LsdException Locked="false" Priority="67" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 1 Accent 6" /> <w:LsdException Locked="false" Priority="68" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 2 Accent 6" /> <w:LsdException Locked="false" Priority="69" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 3 Accent 6" /> <w:LsdException Locked="false" Priority="70" SemiHidden="false"    UnhideWhenUsed="false" Name="Dark List Accent 6" /> <w:LsdException Locked="false" Priority="71" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Shading Accent 6" /> <w:LsdException Locked="false" Priority="72" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful List Accent 6" /> <w:LsdException Locked="false" Priority="73" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Grid Accent 6" /> <w:LsdException Locked="false" Priority="19" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="Subtle Emphasis" /> <w:LsdException Locked="false" Priority="21" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="Intense Emphasis" /> <w:LsdException Locked="false" Priority="31" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="Subtle Reference" /> <w:LsdException Locked="false" Priority="32" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="Intense Reference" /> <w:LsdException Locked="false" Priority="33" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="Book Title" /> <w:LsdException Locked="false" Priority="37" Name="Bibliography" /> <w:LsdException Locked="false" Priority="39" QFormat="true" Name="TOC Heading" /> </w:LatentStyles> </xml><![endif]--> <!--[if gte mso 10]> <mce:style><!   /* Style Definitions */  table.MsoNormalTable 	{mso-style-name:"Tabla normal"; 	mso-tstyle-rowband-size:0; 	mso-tstyle-colband-size:0; 	mso-style-noshow:yes; 	mso-style-priority:99; 	mso-style-qformat:yes; 	mso-style-parent:""; 	mso-padding-alt:0cm 5.4pt 0cm 5.4pt; 	mso-para-margin:0cm; 	mso-para-margin-bottom:.0001pt; 	mso-pagination:widow-orphan; 	font-size:11.0pt; 	font-family:"Calibri","sans-serif"; 	mso-ascii-font-family:Calibri; 	mso-ascii-theme-font:minor-latin; 	mso-fareast-font-family:"Times New Roman"; 	mso-fareast-theme-font:minor-fareast; 	mso-hansi-font-family:Calibri; 	mso-hansi-theme-font:minor-latin; 	mso-bidi-font-family:"Times New Roman"; 	mso-bidi-theme-font:minor-bidi;} --> <!--[endif]--></p>
<p class="Cdigofuente"><em><span style="font-size: 12pt; font-family: &quot;Times New Roman&quot;,&quot;serif&quot;;">&lt;private/public/protected&gt; <strong>delegate</strong> &lt;tipoRetorno&gt; &lt;nombreDelegado&gt; <strong>(</strong>&lt;parámetros&gt;<strong>);</strong></span></em></p>
<p class="MsoNormal" style="text-align: justify;">Un Ejemplo de esto seria</p>
<p class="MsoNormal" style="text-align: justify;"><em> </em></p>
<p class="MsoNormal" style="text-align: justify;"><em>public delegate int randomNumber(int seed);</em></p>
<p class="MsoNormal" style="text-align: justify;"><em> </em></p>
<p><span style="font-size: 12pt; font-family: &quot;Times New Roman&quot;,&quot;serif&quot;;">Las clases delegadas solo pueden contener métodos que<span> </span>cumplan con los mismos valores de retorno y parámetros que las clases delegadas. </span><span style="font-size: 12pt; font-family: &quot;Times New Roman&quot;,&quot;serif&quot;;">Un ejemplo de esto seria:</span></p>

<div class="wp_syntax"><div class="code"><pre class="java java" style="font-family:monospace;">using <span style="color: #003399;">System</span>;
using <span style="color: #003399;">System</span>.<span style="color: #003399;">Collections</span>.<span style="color: #006633;">Generic</span>;
using <span style="color: #003399;">System</span>.<span style="color: #006633;">Text</span>;
using <span style="color: #003399;">System</span>.<span style="color: #006633;">Reflection</span>;
&nbsp;
namespace PrimerEjemploDelegado
<span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">public</span> delegate <span style="color: #000066; font-weight: bold;">void</span> sayHello<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
    <span style="color: #000000; font-weight: bold;">public</span> delegate <span style="color: #003399;">String</span>  getHelloWorld<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
    <span style="color: #000000; font-weight: bold;">public</span> delegate <span style="color: #000066; font-weight: bold;">void</span> sayHelloMore<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
&nbsp;
    <span style="color: #000000; font-weight: bold;">class</span> Program
    <span style="color: #009900;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000066; font-weight: bold;">void</span> Main<span style="color: #009900;">&#40;</span>string<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> args<span style="color: #009900;">&#41;</span>
        <span style="color: #009900;">&#123;</span>
            <span style="color: #000000; font-weight: bold;">try</span>
            <span style="color: #009900;">&#123;</span>
                Type t <span style="color: #339933;">=</span> typeof<span style="color: #009900;">&#40;</span>Program<span style="color: #009900;">&#41;</span>;
                MethodInfo m <span style="color: #339933;">=</span> t.<span style="color: #006633;">GetMethod</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;sayHelloMethod&quot;</span><span style="color: #009900;">&#41;</span>;
                sayHello sayHello <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>sayHello<span style="color: #009900;">&#41;</span><span style="color: #003399;">Delegate</span>.<span style="color: #006633;">CreateDelegate</span><span style="color: #009900;">&#40;</span>typeof<span style="color: #009900;">&#40;</span>sayHello<span style="color: #009900;">&#41;</span>, m<span style="color: #009900;">&#41;</span>;
                sayHello.<span style="color: #006633;">Invoke</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
&nbsp;
            <span style="color: #009900;">&#125;</span>
            <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span><span style="color: #003399;">Exception</span> ex<span style="color: #009900;">&#41;</span>
            <span style="color: #009900;">&#123;</span>
                <span style="color: #003399;">System</span>.<span style="color: #006633;">Console</span>.<span style="color: #006633;">WriteLine</span><span style="color: #009900;">&#40;</span>ex.<span style="color: #006633;">Message</span><span style="color: #009900;">&#41;</span>;
            <span style="color: #009900;">&#125;</span>
            <span style="color: #000000; font-weight: bold;">finally</span>
            <span style="color: #009900;">&#123;</span>
                <span style="color: #003399;">System</span>.<span style="color: #006633;">Console</span>.<span style="color: #006633;">ReadKey</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
            <span style="color: #009900;">&#125;</span>
        <span style="color: #009900;">&#125;</span>
&nbsp;
        <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000066; font-weight: bold;">void</span> sayHelloMethod<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
        <span style="color: #009900;">&#123;</span>
            <span style="color: #003399;">System</span>.<span style="color: #006633;">Console</span>.<span style="color: #006633;">WriteLine</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;hola&quot;</span><span style="color: #009900;">&#41;</span>;
        <span style="color: #009900;">&#125;</span>
        <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #003399;">String</span> getHello<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
        <span style="color: #009900;">&#123;</span>
            <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #0000ff;">&quot;hola&quot;</span>;
        <span style="color: #009900;">&#125;</span>
        <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000066; font-weight: bold;">void</span> sayHelloMore<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> msj<span style="color: #009900;">&#41;</span>
        <span style="color: #009900;">&#123;</span>
            <span style="color: #003399;">System</span>.<span style="color: #006633;">Console</span>.<span style="color: #006633;">WriteLine</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;hola &quot;</span><span style="color: #339933;">+</span>msj<span style="color: #009900;">&#41;</span>;
        <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p><!--[if gte mso 9]><xml> <w:WordDocument> <w:View>Normal</w:View> <w:Zoom>0</w:Zoom> <w:TrackMoves /> <w:TrackFormatting /> <w:HyphenationZone>21</w:HyphenationZone> <w:PunctuationKerning /> <w:ValidateAgainstSchemas /> <w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid> <w:IgnoreMixedContent>false</w:IgnoreMixedContent> <w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText> <w:DoNotPromoteQF /> <w:LidThemeOther>ES-CR</w:LidThemeOther> <w:LidThemeAsian>X-NONE</w:LidThemeAsian> <w:LidThemeComplexScript>X-NONE</w:LidThemeComplexScript> <w:Compatibility> <w:BreakWrappedTables /> <w:SnapToGridInCell /> <w:WrapTextWithPunct /> <w:UseAsianBreakRules /> <w:DontGrowAutofit /> <w:SplitPgBreakAndParaMark /> <w:DontVertAlignCellWithSp /> <w:DontBreakConstrainedForcedTables /> <w:DontVertAlignInTxbx /> <w:Word11KerningPairs /> <w:CachedColBalance /> </w:Compatibility> <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel> <m:mathPr> <m:mathFont m:val="Cambria Math" /> <m:brkBin m:val="before" /> <m:brkBinSub m:val=" " /> <m:smallFrac m:val="off" /> <m:dispDef /> <m:lMargin m:val="0" /> <m:rMargin m:val="0" /> <m:defJc m:val="centerGroup" /> <m:wrapIndent m:val="1440" /> <m:intLim m:val="subSup" /> <m:naryLim m:val="undOvr" /> </m:mathPr></w:WordDocument> </xml><![endif]--><!--[if gte mso 9]><xml> <w:LatentStyles DefLockedState="false" DefUnhideWhenUsed="true"   DefSemiHidden="true" DefQFormat="false" DefPriority="99"   LatentStyleCount="267"> <w:LsdException Locked="false" Priority="0" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="Normal" /> <w:LsdException Locked="false" Priority="9" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="heading 1" /> <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 2" /> <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 3" /> <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 4" /> <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 5" /> <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 6" /> <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 7" /> <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 8" /> <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 9" /> <w:LsdException Locked="false" Priority="39" Name="toc 1" /> <w:LsdException Locked="false" Priority="39" Name="toc 2" /> <w:LsdException Locked="false" Priority="39" Name="toc 3" /> <w:LsdException Locked="false" Priority="39" Name="toc 4" /> <w:LsdException Locked="false" Priority="39" Name="toc 5" /> <w:LsdException Locked="false" Priority="39" Name="toc 6" /> <w:LsdException Locked="false" Priority="39" Name="toc 7" /> <w:LsdException Locked="false" Priority="39" Name="toc 8" /> <w:LsdException Locked="false" Priority="39" Name="toc 9" /> <w:LsdException Locked="false" Priority="35" QFormat="true" Name="caption" /> <w:LsdException Locked="false" Priority="10" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="Title" /> <w:LsdException Locked="false" Priority="1" Name="Default Paragraph Font" /> <w:LsdException Locked="false" Priority="11" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="Subtitle" /> <w:LsdException Locked="false" Priority="22" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="Strong" /> <w:LsdException Locked="false" Priority="20" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="Emphasis" /> <w:LsdException Locked="false" Priority="59" SemiHidden="false"    UnhideWhenUsed="false" Name="Table Grid" /> <w:LsdException Locked="false" UnhideWhenUsed="false" Name="Placeholder Text" /> <w:LsdException Locked="false" Priority="1" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="No Spacing" /> <w:LsdException Locked="false" Priority="60" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Shading" /> <w:LsdException Locked="false" Priority="61" SemiHidden="false"    UnhideWhenUsed="false" Name="Light List" /> <w:LsdException Locked="false" Priority="62" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Grid" /> <w:LsdException Locked="false" Priority="63" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 1" /> <w:LsdException Locked="false" Priority="64" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 2" /> <w:LsdException Locked="false" Priority="65" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 1" /> <w:LsdException Locked="false" Priority="66" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 2" /> <w:LsdException Locked="false" Priority="67" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 1" /> <w:LsdException Locked="false" Priority="68" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 2" /> <w:LsdException Locked="false" Priority="69" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 3" /> <w:LsdException Locked="false" Priority="70" SemiHidden="false"    UnhideWhenUsed="false" Name="Dark List" /> <w:LsdException Locked="false" Priority="71" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Shading" /> <w:LsdException Locked="false" Priority="72" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful List" /> <w:LsdException Locked="false" Priority="73" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Grid" /> <w:LsdException Locked="false" Priority="60" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Shading Accent 1" /> <w:LsdException Locked="false" Priority="61" SemiHidden="false"    UnhideWhenUsed="false" Name="Light List Accent 1" /> <w:LsdException Locked="false" Priority="62" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Grid Accent 1" /> <w:LsdException Locked="false" Priority="63" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 1 Accent 1" /> <w:LsdException Locked="false" Priority="64" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 2 Accent 1" /> <w:LsdException Locked="false" Priority="65" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 1 Accent 1" /> <w:LsdException Locked="false" UnhideWhenUsed="false" Name="Revision" /> <w:LsdException Locked="false" Priority="34" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="List Paragraph" /> <w:LsdException Locked="false" Priority="29" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="Quote" /> <w:LsdException Locked="false" Priority="30" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="Intense Quote" /> <w:LsdException Locked="false" Priority="66" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 2 Accent 1" /> <w:LsdException Locked="false" Priority="67" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 1 Accent 1" /> <w:LsdException Locked="false" Priority="68" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 2 Accent 1" /> <w:LsdException Locked="false" Priority="69" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 3 Accent 1" /> <w:LsdException Locked="false" Priority="70" SemiHidden="false"    UnhideWhenUsed="false" Name="Dark List Accent 1" /> <w:LsdException Locked="false" Priority="71" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Shading Accent 1" /> <w:LsdException Locked="false" Priority="72" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful List Accent 1" /> <w:LsdException Locked="false" Priority="73" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Grid Accent 1" /> <w:LsdException Locked="false" Priority="60" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Shading Accent 2" /> <w:LsdException Locked="false" Priority="61" SemiHidden="false"    UnhideWhenUsed="false" Name="Light List Accent 2" /> <w:LsdException Locked="false" Priority="62" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Grid Accent 2" /> <w:LsdException Locked="false" Priority="63" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 1 Accent 2" /> <w:LsdException Locked="false" Priority="64" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 2 Accent 2" /> <w:LsdException Locked="false" Priority="65" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 1 Accent 2" /> <w:LsdException Locked="false" Priority="66" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 2 Accent 2" /> <w:LsdException Locked="false" Priority="67" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 1 Accent 2" /> <w:LsdException Locked="false" Priority="68" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 2 Accent 2" /> <w:LsdException Locked="false" Priority="69" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 3 Accent 2" /> <w:LsdException Locked="false" Priority="70" SemiHidden="false"    UnhideWhenUsed="false" Name="Dark List Accent 2" /> <w:LsdException Locked="false" Priority="71" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Shading Accent 2" /> <w:LsdException Locked="false" Priority="72" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful List Accent 2" /> <w:LsdException Locked="false" Priority="73" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Grid Accent 2" /> <w:LsdException Locked="false" Priority="60" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Shading Accent 3" /> <w:LsdException Locked="false" Priority="61" SemiHidden="false"    UnhideWhenUsed="false" Name="Light List Accent 3" /> <w:LsdException Locked="false" Priority="62" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Grid Accent 3" /> <w:LsdException Locked="false" Priority="63" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 1 Accent 3" /> <w:LsdException Locked="false" Priority="64" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 2 Accent 3" /> <w:LsdException Locked="false" Priority="65" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 1 Accent 3" /> <w:LsdException Locked="false" Priority="66" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 2 Accent 3" /> <w:LsdException Locked="false" Priority="67" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 1 Accent 3" /> <w:LsdException Locked="false" Priority="68" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 2 Accent 3" /> <w:LsdException Locked="false" Priority="69" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 3 Accent 3" /> <w:LsdException Locked="false" Priority="70" SemiHidden="false"    UnhideWhenUsed="false" Name="Dark List Accent 3" /> <w:LsdException Locked="false" Priority="71" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Shading Accent 3" /> <w:LsdException Locked="false" Priority="72" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful List Accent 3" /> <w:LsdException Locked="false" Priority="73" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Grid Accent 3" /> <w:LsdException Locked="false" Priority="60" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Shading Accent 4" /> <w:LsdException Locked="false" Priority="61" SemiHidden="false"    UnhideWhenUsed="false" Name="Light List Accent 4" /> <w:LsdException Locked="false" Priority="62" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Grid Accent 4" /> <w:LsdException Locked="false" Priority="63" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 1 Accent 4" /> <w:LsdException Locked="false" Priority="64" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 2 Accent 4" /> <w:LsdException Locked="false" Priority="65" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 1 Accent 4" /> <w:LsdException Locked="false" Priority="66" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 2 Accent 4" /> <w:LsdException Locked="false" Priority="67" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 1 Accent 4" /> <w:LsdException Locked="false" Priority="68" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 2 Accent 4" /> <w:LsdException Locked="false" Priority="69" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 3 Accent 4" /> <w:LsdException Locked="false" Priority="70" SemiHidden="false"    UnhideWhenUsed="false" Name="Dark List Accent 4" /> <w:LsdException Locked="false" Priority="71" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Shading Accent 4" /> <w:LsdException Locked="false" Priority="72" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful List Accent 4" /> <w:LsdException Locked="false" Priority="73" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Grid Accent 4" /> <w:LsdException Locked="false" Priority="60" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Shading Accent 5" /> <w:LsdException Locked="false" Priority="61" SemiHidden="false"    UnhideWhenUsed="false" Name="Light List Accent 5" /> <w:LsdException Locked="false" Priority="62" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Grid Accent 5" /> <w:LsdException Locked="false" Priority="63" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 1 Accent 5" /> <w:LsdException Locked="false" Priority="64" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 2 Accent 5" /> <w:LsdException Locked="false" Priority="65" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 1 Accent 5" /> <w:LsdException Locked="false" Priority="66" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 2 Accent 5" /> <w:LsdException Locked="false" Priority="67" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 1 Accent 5" /> <w:LsdException Locked="false" Priority="68" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 2 Accent 5" /> <w:LsdException Locked="false" Priority="69" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 3 Accent 5" /> <w:LsdException Locked="false" Priority="70" SemiHidden="false"    UnhideWhenUsed="false" Name="Dark List Accent 5" /> <w:LsdException Locked="false" Priority="71" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Shading Accent 5" /> <w:LsdException Locked="false" Priority="72" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful List Accent 5" /> <w:LsdException Locked="false" Priority="73" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Grid Accent 5" /> <w:LsdException Locked="false" Priority="60" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Shading Accent 6" /> <w:LsdException Locked="false" Priority="61" SemiHidden="false"    UnhideWhenUsed="false" Name="Light List Accent 6" /> <w:LsdException Locked="false" Priority="62" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Grid Accent 6" /> <w:LsdException Locked="false" Priority="63" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 1 Accent 6" /> <w:LsdException Locked="false" Priority="64" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 2 Accent 6" /> <w:LsdException Locked="false" Priority="65" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 1 Accent 6" /> <w:LsdException Locked="false" Priority="66" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 2 Accent 6" /> <w:LsdException Locked="false" Priority="67" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 1 Accent 6" /> <w:LsdException Locked="false" Priority="68" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 2 Accent 6" /> <w:LsdException Locked="false" Priority="69" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 3 Accent 6" /> <w:LsdException Locked="false" Priority="70" SemiHidden="false"    UnhideWhenUsed="false" Name="Dark List Accent 6" /> <w:LsdException Locked="false" Priority="71" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Shading Accent 6" /> <w:LsdException Locked="false" Priority="72" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful List Accent 6" /> <w:LsdException Locked="false" Priority="73" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Grid Accent 6" /> <w:LsdException Locked="false" Priority="19" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="Subtle Emphasis" /> <w:LsdException Locked="false" Priority="21" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="Intense Emphasis" /> <w:LsdException Locked="false" Priority="31" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="Subtle Reference" /> <w:LsdException Locked="false" Priority="32" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="Intense Reference" /> <w:LsdException Locked="false" Priority="33" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="Book Title" /> <w:LsdException Locked="false" Priority="37" Name="Bibliography" /> <w:LsdException Locked="false" Priority="39" QFormat="true" Name="TOC Heading" /> </w:LatentStyles> </xml><![endif]--> <!--[if gte mso 10]> <mce:style><!   /* Style Definitions */  table.MsoNormalTable 	{mso-style-name:"Tabla normal"; 	mso-tstyle-rowband-size:0; 	mso-tstyle-colband-size:0; 	mso-style-noshow:yes; 	mso-style-priority:99; 	mso-style-qformat:yes; 	mso-style-parent:""; 	mso-padding-alt:0cm 5.4pt 0cm 5.4pt; 	mso-para-margin:0cm; 	mso-para-margin-bottom:.0001pt; 	mso-pagination:widow-orphan; 	font-size:11.0pt; 	font-family:"Calibri","sans-serif"; 	mso-ascii-font-family:Calibri; 	mso-ascii-theme-font:minor-latin; 	mso-fareast-font-family:"Times New Roman"; 	mso-fareast-theme-font:minor-fareast; 	mso-hansi-font-family:Calibri; 	mso-hansi-theme-font:minor-latin; 	mso-bidi-font-family:"Times New Roman"; 	mso-bidi-theme-font:minor-bidi;} --> <!--[endif]--></p>
<p class="MsoNormal" style="text-align: justify;"><span style="color: black;">Como vemos si cambiamos<span> </span>esta<span> </span>linea </span><em><span style="color: black;">MethodInfo m = t.GetMethod(&#8221;sayHelloMethod&#8221;);</span></em><span style="color: black;"> por cualquier de los otros <span> </span>metodos el programa nos lanzara una excepcion ya que los otros metodos reciben parametros diferentes y retornan valores.</span></p>
<p class="MsoNormal" style="text-align: justify;"><span style="color: black;">Otra forma de realizar una asignacion de un metodo delegado seria algo asi.</span></p>
<p class="MsoNormal" style="text-align: justify;">

<div class="wp_syntax"><div class="code"><pre class="java java" style="font-family:monospace;">using <span style="color: #003399;">System</span>;
using <span style="color: #003399;">System</span>.<span style="color: #003399;">Collections</span>.<span style="color: #006633;">Generic</span>;
using <span style="color: #003399;">System</span>.<span style="color: #006633;">Text</span>;
&nbsp;
namespace SegundoEjemploDelegado
<span style="color: #009900;">&#123;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">class</span> Program
    <span style="color: #009900;">&#123;</span>
&nbsp;
        <span style="color: #000000; font-weight: bold;">public</span> delegate <span style="color: #000066; font-weight: bold;">int</span> Suma<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> a, <span style="color: #000066; font-weight: bold;">int</span> b<span style="color: #009900;">&#41;</span>;
        <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000000; font-weight: bold;">static</span> Suma suma;
        <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> Suma SumaObj
        <span style="color: #009900;">&#123;</span>
            get
            <span style="color: #009900;">&#123;</span>
               <span style="color: #000000; font-weight: bold;">return</span> suma;
            <span style="color: #009900;">&#125;</span>
            set
            <span style="color: #009900;">&#123;</span>
                suma <span style="color: #339933;">=</span> value;
            <span style="color: #009900;">&#125;</span>
        <span style="color: #009900;">&#125;</span>
&nbsp;
        <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000066; font-weight: bold;">void</span> Main<span style="color: #009900;">&#40;</span>string<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> args<span style="color: #009900;">&#41;</span>
        <span style="color: #009900;">&#123;</span>
            ObjetoConUnMetodo b <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> ObjetoConUnMetodo<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
            <span style="color: #003399;">System</span>.<span style="color: #006633;">Console</span>.<span style="color: #006633;">WriteLine</span><span style="color: #009900;">&#40;</span>Program.<span style="color: #006633;">SumaObj</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">5</span>,<span style="color: #cc66cc;">10</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>;
            Console.<span style="color: #006633;">ReadKey</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
        <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">class</span> ObjetoConUnMetodo
    <span style="color: #009900;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">public</span> ObjetoConUnMetodo<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
        <span style="color: #009900;">&#123;</span>
            Program.<span style="color: #006633;">SumaObj</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Program.<span style="color: #006633;">Suma</span><span style="color: #009900;">&#40;</span>Suma<span style="color: #009900;">&#41;</span>;
        <span style="color: #009900;">&#125;</span>
        <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000066; font-weight: bold;">int</span> Suma<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> c, <span style="color: #000066; font-weight: bold;">int</span> b<span style="color: #009900;">&#41;</span>
        <span style="color: #009900;">&#123;</span>
            <span style="color: #000000; font-weight: bold;">return</span> c <span style="color: #339933;">+</span> b;
        <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p><!--[if gte mso 9]><xml> <w:WordDocument> <w:View>Normal</w:View> <w:Zoom>0</w:Zoom> <w:TrackMoves /> <w:TrackFormatting /> <w:HyphenationZone>21</w:HyphenationZone> <w:PunctuationKerning /> <w:ValidateAgainstSchemas /> <w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid> <w:IgnoreMixedContent>false</w:IgnoreMixedContent> <w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText> <w:DoNotPromoteQF /> <w:LidThemeOther>ES-CR</w:LidThemeOther> <w:LidThemeAsian>X-NONE</w:LidThemeAsian> <w:LidThemeComplexScript>X-NONE</w:LidThemeComplexScript> <w:Compatibility> <w:BreakWrappedTables /> <w:SnapToGridInCell /> <w:WrapTextWithPunct /> <w:UseAsianBreakRules /> <w:DontGrowAutofit /> <w:SplitPgBreakAndParaMark /> <w:DontVertAlignCellWithSp /> <w:DontBreakConstrainedForcedTables /> <w:DontVertAlignInTxbx /> <w:Word11KerningPairs /> <w:CachedColBalance /> </w:Compatibility> <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel> <m:mathPr> <m:mathFont m:val="Cambria Math" /> <m:brkBin m:val="before" /> <m:brkBinSub m:val=" " /> <m:smallFrac m:val="off" /> <m:dispDef /> <m:lMargin m:val="0" /> <m:rMargin m:val="0" /> <m:defJc m:val="centerGroup" /> <m:wrapIndent m:val="1440" /> <m:intLim m:val="subSup" /> <m:naryLim m:val="undOvr" /> </m:mathPr></w:WordDocument> </xml><![endif]--><!--[if gte mso 9]><xml> <w:LatentStyles DefLockedState="false" DefUnhideWhenUsed="true"   DefSemiHidden="true" DefQFormat="false" DefPriority="99"   LatentStyleCount="267"> <w:LsdException Locked="false" Priority="0" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="Normal" /> <w:LsdException Locked="false" Priority="9" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="heading 1" /> <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 2" /> <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 3" /> <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 4" /> <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 5" /> <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 6" /> <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 7" /> <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 8" /> <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 9" /> <w:LsdException Locked="false" Priority="39" Name="toc 1" /> <w:LsdException Locked="false" Priority="39" Name="toc 2" /> <w:LsdException Locked="false" Priority="39" Name="toc 3" /> <w:LsdException Locked="false" Priority="39" Name="toc 4" /> <w:LsdException Locked="false" Priority="39" Name="toc 5" /> <w:LsdException Locked="false" Priority="39" Name="toc 6" /> <w:LsdException Locked="false" Priority="39" Name="toc 7" /> <w:LsdException Locked="false" Priority="39" Name="toc 8" /> <w:LsdException Locked="false" Priority="39" Name="toc 9" /> <w:LsdException Locked="false" Priority="35" QFormat="true" Name="caption" /> <w:LsdException Locked="false" Priority="10" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="Title" /> <w:LsdException Locked="false" Priority="1" Name="Default Paragraph Font" /> <w:LsdException Locked="false" Priority="11" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="Subtitle" /> <w:LsdException Locked="false" Priority="22" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="Strong" /> <w:LsdException Locked="false" Priority="20" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="Emphasis" /> <w:LsdException Locked="false" Priority="59" SemiHidden="false"    UnhideWhenUsed="false" Name="Table Grid" /> <w:LsdException Locked="false" UnhideWhenUsed="false" Name="Placeholder Text" /> <w:LsdException Locked="false" Priority="1" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="No Spacing" /> <w:LsdException Locked="false" Priority="60" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Shading" /> <w:LsdException Locked="false" Priority="61" SemiHidden="false"    UnhideWhenUsed="false" Name="Light List" /> <w:LsdException Locked="false" Priority="62" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Grid" /> <w:LsdException Locked="false" Priority="63" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 1" /> <w:LsdException Locked="false" Priority="64" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 2" /> <w:LsdException Locked="false" Priority="65" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 1" /> <w:LsdException Locked="false" Priority="66" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 2" /> <w:LsdException Locked="false" Priority="67" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 1" /> <w:LsdException Locked="false" Priority="68" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 2" /> <w:LsdException Locked="false" Priority="69" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 3" /> <w:LsdException Locked="false" Priority="70" SemiHidden="false"    UnhideWhenUsed="false" Name="Dark List" /> <w:LsdException Locked="false" Priority="71" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Shading" /> <w:LsdException Locked="false" Priority="72" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful List" /> <w:LsdException Locked="false" Priority="73" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Grid" /> <w:LsdException Locked="false" Priority="60" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Shading Accent 1" /> <w:LsdException Locked="false" Priority="61" SemiHidden="false"    UnhideWhenUsed="false" Name="Light List Accent 1" /> <w:LsdException Locked="false" Priority="62" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Grid Accent 1" /> <w:LsdException Locked="false" Priority="63" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 1 Accent 1" /> <w:LsdException Locked="false" Priority="64" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 2 Accent 1" /> <w:LsdException Locked="false" Priority="65" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 1 Accent 1" /> <w:LsdException Locked="false" UnhideWhenUsed="false" Name="Revision" /> <w:LsdException Locked="false" Priority="34" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="List Paragraph" /> <w:LsdException Locked="false" Priority="29" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="Quote" /> <w:LsdException Locked="false" Priority="30" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="Intense Quote" /> <w:LsdException Locked="false" Priority="66" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 2 Accent 1" /> <w:LsdException Locked="false" Priority="67" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 1 Accent 1" /> <w:LsdException Locked="false" Priority="68" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 2 Accent 1" /> <w:LsdException Locked="false" Priority="69" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 3 Accent 1" /> <w:LsdException Locked="false" Priority="70" SemiHidden="false"    UnhideWhenUsed="false" Name="Dark List Accent 1" /> <w:LsdException Locked="false" Priority="71" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Shading Accent 1" /> <w:LsdException Locked="false" Priority="72" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful List Accent 1" /> <w:LsdException Locked="false" Priority="73" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Grid Accent 1" /> <w:LsdException Locked="false" Priority="60" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Shading Accent 2" /> <w:LsdException Locked="false" Priority="61" SemiHidden="false"    UnhideWhenUsed="false" Name="Light List Accent 2" /> <w:LsdException Locked="false" Priority="62" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Grid Accent 2" /> <w:LsdException Locked="false" Priority="63" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 1 Accent 2" /> <w:LsdException Locked="false" Priority="64" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 2 Accent 2" /> <w:LsdException Locked="false" Priority="65" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 1 Accent 2" /> <w:LsdException Locked="false" Priority="66" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 2 Accent 2" /> <w:LsdException Locked="false" Priority="67" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 1 Accent 2" /> <w:LsdException Locked="false" Priority="68" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 2 Accent 2" /> <w:LsdException Locked="false" Priority="69" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 3 Accent 2" /> <w:LsdException Locked="false" Priority="70" SemiHidden="false"    UnhideWhenUsed="false" Name="Dark List Accent 2" /> <w:LsdException Locked="false" Priority="71" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Shading Accent 2" /> <w:LsdException Locked="false" Priority="72" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful List Accent 2" /> <w:LsdException Locked="false" Priority="73" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Grid Accent 2" /> <w:LsdException Locked="false" Priority="60" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Shading Accent 3" /> <w:LsdException Locked="false" Priority="61" SemiHidden="false"    UnhideWhenUsed="false" Name="Light List Accent 3" /> <w:LsdException Locked="false" Priority="62" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Grid Accent 3" /> <w:LsdException Locked="false" Priority="63" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 1 Accent 3" /> <w:LsdException Locked="false" Priority="64" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 2 Accent 3" /> <w:LsdException Locked="false" Priority="65" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 1 Accent 3" /> <w:LsdException Locked="false" Priority="66" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 2 Accent 3" /> <w:LsdException Locked="false" Priority="67" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 1 Accent 3" /> <w:LsdException Locked="false" Priority="68" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 2 Accent 3" /> <w:LsdException Locked="false" Priority="69" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 3 Accent 3" /> <w:LsdException Locked="false" Priority="70" SemiHidden="false"    UnhideWhenUsed="false" Name="Dark List Accent 3" /> <w:LsdException Locked="false" Priority="71" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Shading Accent 3" /> <w:LsdException Locked="false" Priority="72" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful List Accent 3" /> <w:LsdException Locked="false" Priority="73" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Grid Accent 3" /> <w:LsdException Locked="false" Priority="60" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Shading Accent 4" /> <w:LsdException Locked="false" Priority="61" SemiHidden="false"    UnhideWhenUsed="false" Name="Light List Accent 4" /> <w:LsdException Locked="false" Priority="62" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Grid Accent 4" /> <w:LsdException Locked="false" Priority="63" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 1 Accent 4" /> <w:LsdException Locked="false" Priority="64" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 2 Accent 4" /> <w:LsdException Locked="false" Priority="65" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 1 Accent 4" /> <w:LsdException Locked="false" Priority="66" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 2 Accent 4" /> <w:LsdException Locked="false" Priority="67" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 1 Accent 4" /> <w:LsdException Locked="false" Priority="68" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 2 Accent 4" /> <w:LsdException Locked="false" Priority="69" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 3 Accent 4" /> <w:LsdException Locked="false" Priority="70" SemiHidden="false"    UnhideWhenUsed="false" Name="Dark List Accent 4" /> <w:LsdException Locked="false" Priority="71" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Shading Accent 4" /> <w:LsdException Locked="false" Priority="72" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful List Accent 4" /> <w:LsdException Locked="false" Priority="73" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Grid Accent 4" /> <w:LsdException Locked="false" Priority="60" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Shading Accent 5" /> <w:LsdException Locked="false" Priority="61" SemiHidden="false"    UnhideWhenUsed="false" Name="Light List Accent 5" /> <w:LsdException Locked="false" Priority="62" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Grid Accent 5" /> <w:LsdException Locked="false" Priority="63" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 1 Accent 5" /> <w:LsdException Locked="false" Priority="64" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 2 Accent 5" /> <w:LsdException Locked="false" Priority="65" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 1 Accent 5" /> <w:LsdException Locked="false" Priority="66" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 2 Accent 5" /> <w:LsdException Locked="false" Priority="67" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 1 Accent 5" /> <w:LsdException Locked="false" Priority="68" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 2 Accent 5" /> <w:LsdException Locked="false" Priority="69" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 3 Accent 5" /> <w:LsdException Locked="false" Priority="70" SemiHidden="false"    UnhideWhenUsed="false" Name="Dark List Accent 5" /> <w:LsdException Locked="false" Priority="71" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Shading Accent 5" /> <w:LsdException Locked="false" Priority="72" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful List Accent 5" /> <w:LsdException Locked="false" Priority="73" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Grid Accent 5" /> <w:LsdException Locked="false" Priority="60" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Shading Accent 6" /> <w:LsdException Locked="false" Priority="61" SemiHidden="false"    UnhideWhenUsed="false" Name="Light List Accent 6" /> <w:LsdException Locked="false" Priority="62" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Grid Accent 6" /> <w:LsdException Locked="false" Priority="63" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 1 Accent 6" /> <w:LsdException Locked="false" Priority="64" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 2 Accent 6" /> <w:LsdException Locked="false" Priority="65" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 1 Accent 6" /> <w:LsdException Locked="false" Priority="66" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 2 Accent 6" /> <w:LsdException Locked="false" Priority="67" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 1 Accent 6" /> <w:LsdException Locked="false" Priority="68" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 2 Accent 6" /> <w:LsdException Locked="false" Priority="69" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 3 Accent 6" /> <w:LsdException Locked="false" Priority="70" SemiHidden="false"    UnhideWhenUsed="false" Name="Dark List Accent 6" /> <w:LsdException Locked="false" Priority="71" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Shading Accent 6" /> <w:LsdException Locked="false" Priority="72" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful List Accent 6" /> <w:LsdException Locked="false" Priority="73" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Grid Accent 6" /> <w:LsdException Locked="false" Priority="19" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="Subtle Emphasis" /> <w:LsdException Locked="false" Priority="21" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="Intense Emphasis" /> <w:LsdException Locked="false" Priority="31" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="Subtle Reference" /> <w:LsdException Locked="false" Priority="32" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="Intense Reference" /> <w:LsdException Locked="false" Priority="33" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="Book Title" /> <w:LsdException Locked="false" Priority="37" Name="Bibliography" /> <w:LsdException Locked="false" Priority="39" QFormat="true" Name="TOC Heading" /> </w:LatentStyles> </xml><![endif]--> <!--[if gte mso 10]><br />
<mce:style><!   /* Style Definitions */  table.MsoNormalTable 	{mso-style-name:"Tabla normal"; 	mso-tstyle-rowband-size:0; 	mso-tstyle-colband-size:0; 	mso-style-noshow:yes; 	mso-style-priority:99; 	mso-style-qformat:yes; 	mso-style-parent:""; 	mso-padding-alt:0cm 5.4pt 0cm 5.4pt; 	mso-para-margin:0cm; 	mso-para-margin-bottom:.0001pt; 	mso-pagination:widow-orphan; 	font-size:11.0pt; 	font-family:"Calibri","sans-serif"; 	mso-ascii-font-family:Calibri; 	mso-ascii-theme-font:minor-latin; 	mso-fareast-font-family:"Times New Roman"; 	mso-fareast-theme-font:minor-fareast; 	mso-hansi-font-family:Calibri; 	mso-hansi-theme-font:minor-latin; 	mso-bidi-font-family:"Times New Roman"; 	mso-bidi-theme-font:minor-bidi;} --></p>
<p><!--[endif]--></p>
<p class="MsoNormal" style="text-align: justify;"><span style="color: black;">Como vemos el objeto “ObjectoConUnMetodo” es el encargado de registrar la implementacion de sumar al objecto delegado. Ahora vamos a intentar que el objeto delegado reciba n metodos y los llame sin que este se de cuenta. El codigo seria asi:</span></p>

<div class="wp_syntax"><div class="code"><pre class="java java" style="font-family:monospace;">using <span style="color: #003399;">System</span>;
using <span style="color: #003399;">System</span>.<span style="color: #003399;">Collections</span>.<span style="color: #006633;">Generic</span>;
using <span style="color: #003399;">System</span>.<span style="color: #006633;">Text</span>;
&nbsp;
namespace TercerEjemploDelegado
<span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">class</span> Program
    <span style="color: #009900;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">public</span> delegate <span style="color: #000066; font-weight: bold;">void</span> OperacionesBasicas<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> a, <span style="color: #000066; font-weight: bold;">int</span> b<span style="color: #009900;">&#41;</span>;
        <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000000; font-weight: bold;">static</span> OperacionesBasicas operacion;
&nbsp;
        <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> OperacionesBasicas Operacion
        <span style="color: #009900;">&#123;</span>
            get
            <span style="color: #009900;">&#123;</span>
                <span style="color: #000000; font-weight: bold;">return</span> operacion;
            <span style="color: #009900;">&#125;</span>
            set
            <span style="color: #009900;">&#123;</span>
                operacion <span style="color: #339933;">=</span> value;
            <span style="color: #009900;">&#125;</span>
        <span style="color: #009900;">&#125;</span>
        <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000066; font-weight: bold;">void</span> Main<span style="color: #009900;">&#40;</span>string<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> args<span style="color: #009900;">&#41;</span>
        <span style="color: #009900;">&#123;</span>
            <span style="color: #000000; font-weight: bold;">try</span>
            <span style="color: #009900;">&#123;</span>
                Implementacion a <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Implementacion<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
                Program.<span style="color: #006633;">Operacion</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">20</span>,<span style="color: #cc66cc;">5</span><span style="color: #009900;">&#41;</span>;
                Console.<span style="color: #006633;">ReadKey</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
            <span style="color: #009900;">&#125;</span>
            <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span><span style="color: #003399;">Exception</span> e<span style="color: #009900;">&#41;</span>
            <span style="color: #009900;">&#123;</span>
                Console.<span style="color: #006633;">WriteLine</span><span style="color: #009900;">&#40;</span>e.<span style="color: #006633;">Message</span><span style="color: #009900;">&#41;</span>;
            <span style="color: #009900;">&#125;</span>
        <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> Implementacion
    <span style="color: #009900;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">public</span> Implementacion<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
        <span style="color: #009900;">&#123;</span>
            Program.<span style="color: #006633;">Operacion</span> <span style="color: #339933;">+=</span> <span style="color: #000000; font-weight: bold;">new</span> Program.<span style="color: #006633;">OperacionesBasicas</span><span style="color: #009900;">&#40;</span>Suma<span style="color: #009900;">&#41;</span>;
            Program.<span style="color: #006633;">Operacion</span> <span style="color: #339933;">+=</span> <span style="color: #000000; font-weight: bold;">new</span> Program.<span style="color: #006633;">OperacionesBasicas</span><span style="color: #009900;">&#40;</span>Resta<span style="color: #009900;">&#41;</span>;
            Program.<span style="color: #006633;">Operacion</span> <span style="color: #339933;">+=</span> <span style="color: #000000; font-weight: bold;">new</span> Program.<span style="color: #006633;">OperacionesBasicas</span><span style="color: #009900;">&#40;</span>Multiplicacion<span style="color: #009900;">&#41;</span>;
            Program.<span style="color: #006633;">Operacion</span> <span style="color: #339933;">+=</span> <span style="color: #000000; font-weight: bold;">new</span> Program.<span style="color: #006633;">OperacionesBasicas</span><span style="color: #009900;">&#40;</span>Division<span style="color: #009900;">&#41;</span>;
        <span style="color: #009900;">&#125;</span>
&nbsp;
        <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000066; font-weight: bold;">void</span> Suma<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> a, <span style="color: #000066; font-weight: bold;">int</span> b<span style="color: #009900;">&#41;</span>
        <span style="color: #009900;">&#123;</span>
            <span style="color: #003399;">System</span>.<span style="color: #006633;">Console</span>.<span style="color: #006633;">WriteLine</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Yo estoy sumando {0} y {1} y el resultado es {2}&quot;</span>, a, b, a <span style="color: #339933;">+</span> b<span style="color: #009900;">&#41;</span>;
        <span style="color: #009900;">&#125;</span>
        <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000066; font-weight: bold;">void</span> Resta<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> a, <span style="color: #000066; font-weight: bold;">int</span> b<span style="color: #009900;">&#41;</span>
        <span style="color: #009900;">&#123;</span>
            <span style="color: #003399;">System</span>.<span style="color: #006633;">Console</span>.<span style="color: #006633;">WriteLine</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Yo estoy restando {0} y {1} y el resultado es {2}&quot;</span>, a, b, a <span style="color: #339933;">-</span> b<span style="color: #009900;">&#41;</span>;
        <span style="color: #009900;">&#125;</span>
        <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000066; font-weight: bold;">void</span> Multiplicacion<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> a, <span style="color: #000066; font-weight: bold;">int</span> b<span style="color: #009900;">&#41;</span>
        <span style="color: #009900;">&#123;</span>
            <span style="color: #003399;">System</span>.<span style="color: #006633;">Console</span>.<span style="color: #006633;">WriteLine</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Yo estoy multiplicacion {0} y {1} y el resultado es {2}&quot;</span>, a, b, a <span style="color: #339933;">*</span> b<span style="color: #009900;">&#41;</span>;
        <span style="color: #009900;">&#125;</span>
        <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000066; font-weight: bold;">void</span> Division<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> a, <span style="color: #000066; font-weight: bold;">int</span> b<span style="color: #009900;">&#41;</span>
        <span style="color: #009900;">&#123;</span>
            <span style="color: #003399;">System</span>.<span style="color: #006633;">Console</span>.<span style="color: #006633;">WriteLine</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Yo estoy division {0} y {1} y el resultado es {2}&quot;</span>, a, b, a <span style="color: #339933;">/</span> b<span style="color: #009900;">&#41;</span>;
        <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p><!--[if gte mso 9]><xml> <w:WordDocument> <w:View>Normal</w:View> <w:Zoom>0</w:Zoom> <w:TrackMoves /> <w:TrackFormatting /> <w:HyphenationZone>21</w:HyphenationZone> <w:PunctuationKerning /> <w:ValidateAgainstSchemas /> <w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid> <w:IgnoreMixedContent>false</w:IgnoreMixedContent> <w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText> <w:DoNotPromoteQF /> <w:LidThemeOther>ES-CR</w:LidThemeOther> <w:LidThemeAsian>X-NONE</w:LidThemeAsian> <w:LidThemeComplexScript>X-NONE</w:LidThemeComplexScript> <w:Compatibility> <w:BreakWrappedTables /> <w:SnapToGridInCell /> <w:WrapTextWithPunct /> <w:UseAsianBreakRules /> <w:DontGrowAutofit /> <w:SplitPgBreakAndParaMark /> <w:DontVertAlignCellWithSp /> <w:DontBreakConstrainedForcedTables /> <w:DontVertAlignInTxbx /> <w:Word11KerningPairs /> <w:CachedColBalance /> </w:Compatibility> <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel> <m:mathPr> <m:mathFont m:val="Cambria Math" /> <m:brkBin m:val="before" /> <m:brkBinSub m:val=" " /> <m:smallFrac m:val="off" /> <m:dispDef /> <m:lMargin m:val="0" /> <m:rMargin m:val="0" /> <m:defJc m:val="centerGroup" /> <m:wrapIndent m:val="1440" /> <m:intLim m:val="subSup" /> <m:naryLim m:val="undOvr" /> </m:mathPr></w:WordDocument> </xml><![endif]--><!--[if gte mso 9]><xml> <w:LatentStyles DefLockedState="false" DefUnhideWhenUsed="true"   DefSemiHidden="true" DefQFormat="false" DefPriority="99"   LatentStyleCount="267"> <w:LsdException Locked="false" Priority="0" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="Normal" /> <w:LsdException Locked="false" Priority="9" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="heading 1" /> <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 2" /> <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 3" /> <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 4" /> <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 5" /> <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 6" /> <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 7" /> <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 8" /> <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 9" /> <w:LsdException Locked="false" Priority="39" Name="toc 1" /> <w:LsdException Locked="false" Priority="39" Name="toc 2" /> <w:LsdException Locked="false" Priority="39" Name="toc 3" /> <w:LsdException Locked="false" Priority="39" Name="toc 4" /> <w:LsdException Locked="false" Priority="39" Name="toc 5" /> <w:LsdException Locked="false" Priority="39" Name="toc 6" /> <w:LsdException Locked="false" Priority="39" Name="toc 7" /> <w:LsdException Locked="false" Priority="39" Name="toc 8" /> <w:LsdException Locked="false" Priority="39" Name="toc 9" /> <w:LsdException Locked="false" Priority="35" QFormat="true" Name="caption" /> <w:LsdException Locked="false" Priority="10" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="Title" /> <w:LsdException Locked="false" Priority="1" Name="Default Paragraph Font" /> <w:LsdException Locked="false" Priority="11" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="Subtitle" /> <w:LsdException Locked="false" Priority="22" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="Strong" /> <w:LsdException Locked="false" Priority="20" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="Emphasis" /> <w:LsdException Locked="false" Priority="59" SemiHidden="false"    UnhideWhenUsed="false" Name="Table Grid" /> <w:LsdException Locked="false" UnhideWhenUsed="false" Name="Placeholder Text" /> <w:LsdException Locked="false" Priority="1" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="No Spacing" /> <w:LsdException Locked="false" Priority="60" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Shading" /> <w:LsdException Locked="false" Priority="61" SemiHidden="false"    UnhideWhenUsed="false" Name="Light List" /> <w:LsdException Locked="false" Priority="62" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Grid" /> <w:LsdException Locked="false" Priority="63" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 1" /> <w:LsdException Locked="false" Priority="64" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 2" /> <w:LsdException Locked="false" Priority="65" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 1" /> <w:LsdException Locked="false" Priority="66" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 2" /> <w:LsdException Locked="false" Priority="67" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 1" /> <w:LsdException Locked="false" Priority="68" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 2" /> <w:LsdException Locked="false" Priority="69" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 3" /> <w:LsdException Locked="false" Priority="70" SemiHidden="false"    UnhideWhenUsed="false" Name="Dark List" /> <w:LsdException Locked="false" Priority="71" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Shading" /> <w:LsdException Locked="false" Priority="72" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful List" /> <w:LsdException Locked="false" Priority="73" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Grid" /> <w:LsdException Locked="false" Priority="60" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Shading Accent 1" /> <w:LsdException Locked="false" Priority="61" SemiHidden="false"    UnhideWhenUsed="false" Name="Light List Accent 1" /> <w:LsdException Locked="false" Priority="62" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Grid Accent 1" /> <w:LsdException Locked="false" Priority="63" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 1 Accent 1" /> <w:LsdException Locked="false" Priority="64" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 2 Accent 1" /> <w:LsdException Locked="false" Priority="65" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 1 Accent 1" /> <w:LsdException Locked="false" UnhideWhenUsed="false" Name="Revision" /> <w:LsdException Locked="false" Priority="34" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="List Paragraph" /> <w:LsdException Locked="false" Priority="29" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="Quote" /> <w:LsdException Locked="false" Priority="30" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="Intense Quote" /> <w:LsdException Locked="false" Priority="66" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 2 Accent 1" /> <w:LsdException Locked="false" Priority="67" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 1 Accent 1" /> <w:LsdException Locked="false" Priority="68" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 2 Accent 1" /> <w:LsdException Locked="false" Priority="69" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 3 Accent 1" /> <w:LsdException Locked="false" Priority="70" SemiHidden="false"    UnhideWhenUsed="false" Name="Dark List Accent 1" /> <w:LsdException Locked="false" Priority="71" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Shading Accent 1" /> <w:LsdException Locked="false" Priority="72" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful List Accent 1" /> <w:LsdException Locked="false" Priority="73" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Grid Accent 1" /> <w:LsdException Locked="false" Priority="60" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Shading Accent 2" /> <w:LsdException Locked="false" Priority="61" SemiHidden="false"    UnhideWhenUsed="false" Name="Light List Accent 2" /> <w:LsdException Locked="false" Priority="62" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Grid Accent 2" /> <w:LsdException Locked="false" Priority="63" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 1 Accent 2" /> <w:LsdException Locked="false" Priority="64" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 2 Accent 2" /> <w:LsdException Locked="false" Priority="65" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 1 Accent 2" /> <w:LsdException Locked="false" Priority="66" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 2 Accent 2" /> <w:LsdException Locked="false" Priority="67" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 1 Accent 2" /> <w:LsdException Locked="false" Priority="68" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 2 Accent 2" /> <w:LsdException Locked="false" Priority="69" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 3 Accent 2" /> <w:LsdException Locked="false" Priority="70" SemiHidden="false"    UnhideWhenUsed="false" Name="Dark List Accent 2" /> <w:LsdException Locked="false" Priority="71" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Shading Accent 2" /> <w:LsdException Locked="false" Priority="72" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful List Accent 2" /> <w:LsdException Locked="false" Priority="73" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Grid Accent 2" /> <w:LsdException Locked="false" Priority="60" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Shading Accent 3" /> <w:LsdException Locked="false" Priority="61" SemiHidden="false"    UnhideWhenUsed="false" Name="Light List Accent 3" /> <w:LsdException Locked="false" Priority="62" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Grid Accent 3" /> <w:LsdException Locked="false" Priority="63" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 1 Accent 3" /> <w:LsdException Locked="false" Priority="64" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 2 Accent 3" /> <w:LsdException Locked="false" Priority="65" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 1 Accent 3" /> <w:LsdException Locked="false" Priority="66" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 2 Accent 3" /> <w:LsdException Locked="false" Priority="67" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 1 Accent 3" /> <w:LsdException Locked="false" Priority="68" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 2 Accent 3" /> <w:LsdException Locked="false" Priority="69" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 3 Accent 3" /> <w:LsdException Locked="false" Priority="70" SemiHidden="false"    UnhideWhenUsed="false" Name="Dark List Accent 3" /> <w:LsdException Locked="false" Priority="71" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Shading Accent 3" /> <w:LsdException Locked="false" Priority="72" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful List Accent 3" /> <w:LsdException Locked="false" Priority="73" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Grid Accent 3" /> <w:LsdException Locked="false" Priority="60" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Shading Accent 4" /> <w:LsdException Locked="false" Priority="61" SemiHidden="false"    UnhideWhenUsed="false" Name="Light List Accent 4" /> <w:LsdException Locked="false" Priority="62" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Grid Accent 4" /> <w:LsdException Locked="false" Priority="63" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 1 Accent 4" /> <w:LsdException Locked="false" Priority="64" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 2 Accent 4" /> <w:LsdException Locked="false" Priority="65" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 1 Accent 4" /> <w:LsdException Locked="false" Priority="66" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 2 Accent 4" /> <w:LsdException Locked="false" Priority="67" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 1 Accent 4" /> <w:LsdException Locked="false" Priority="68" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 2 Accent 4" /> <w:LsdException Locked="false" Priority="69" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 3 Accent 4" /> <w:LsdException Locked="false" Priority="70" SemiHidden="false"    UnhideWhenUsed="false" Name="Dark List Accent 4" /> <w:LsdException Locked="false" Priority="71" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Shading Accent 4" /> <w:LsdException Locked="false" Priority="72" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful List Accent 4" /> <w:LsdException Locked="false" Priority="73" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Grid Accent 4" /> <w:LsdException Locked="false" Priority="60" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Shading Accent 5" /> <w:LsdException Locked="false" Priority="61" SemiHidden="false"    UnhideWhenUsed="false" Name="Light List Accent 5" /> <w:LsdException Locked="false" Priority="62" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Grid Accent 5" /> <w:LsdException Locked="false" Priority="63" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 1 Accent 5" /> <w:LsdException Locked="false" Priority="64" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 2 Accent 5" /> <w:LsdException Locked="false" Priority="65" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 1 Accent 5" /> <w:LsdException Locked="false" Priority="66" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 2 Accent 5" /> <w:LsdException Locked="false" Priority="67" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 1 Accent 5" /> <w:LsdException Locked="false" Priority="68" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 2 Accent 5" /> <w:LsdException Locked="false" Priority="69" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 3 Accent 5" /> <w:LsdException Locked="false" Priority="70" SemiHidden="false"    UnhideWhenUsed="false" Name="Dark List Accent 5" /> <w:LsdException Locked="false" Priority="71" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Shading Accent 5" /> <w:LsdException Locked="false" Priority="72" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful List Accent 5" /> <w:LsdException Locked="false" Priority="73" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Grid Accent 5" /> <w:LsdException Locked="false" Priority="60" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Shading Accent 6" /> <w:LsdException Locked="false" Priority="61" SemiHidden="false"    UnhideWhenUsed="false" Name="Light List Accent 6" /> <w:LsdException Locked="false" Priority="62" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Grid Accent 6" /> <w:LsdException Locked="false" Priority="63" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 1 Accent 6" /> <w:LsdException Locked="false" Priority="64" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 2 Accent 6" /> <w:LsdException Locked="false" Priority="65" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 1 Accent 6" /> <w:LsdException Locked="false" Priority="66" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 2 Accent 6" /> <w:LsdException Locked="false" Priority="67" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 1 Accent 6" /> <w:LsdException Locked="false" Priority="68" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 2 Accent 6" /> <w:LsdException Locked="false" Priority="69" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 3 Accent 6" /> <w:LsdException Locked="false" Priority="70" SemiHidden="false"    UnhideWhenUsed="false" Name="Dark List Accent 6" /> <w:LsdException Locked="false" Priority="71" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Shading Accent 6" /> <w:LsdException Locked="false" Priority="72" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful List Accent 6" /> <w:LsdException Locked="false" Priority="73" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Grid Accent 6" /> <w:LsdException Locked="false" Priority="19" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="Subtle Emphasis" /> <w:LsdException Locked="false" Priority="21" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="Intense Emphasis" /> <w:LsdException Locked="false" Priority="31" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="Subtle Reference" /> <w:LsdException Locked="false" Priority="32" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="Intense Reference" /> <w:LsdException Locked="false" Priority="33" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="Book Title" /> <w:LsdException Locked="false" Priority="37" Name="Bibliography" /> <w:LsdException Locked="false" Priority="39" QFormat="true" Name="TOC Heading" /> </w:LatentStyles> </xml><![endif]--><!--  /* Font Definitions */  @font-face 	{font-family:"Cambria Math"; 	panose-1:0 0 0 0 0 0 0 0 0 0; 	mso-font-charset:1; 	mso-generic-font-family:roman; 	mso-font-format:other; 	mso-font-pitch:variable; 	mso-font-signature:0 0 0 0 0 0;}  /* Style Definitions */  p.MsoNormal, li.MsoNormal, div.MsoNormal 	{mso-style-unhide:no; 	mso-style-qformat:yes; 	mso-style-parent:""; 	margin:0cm; 	margin-bottom:.0001pt; 	mso-pagination:widow-orphan; 	font-size:12.0pt; 	font-family:"Times New Roman","serif"; 	mso-fareast-font-family:"Times New Roman"; 	mso-fareast-language:ES;} .MsoChpDefault 	{mso-style-type:export-only; 	mso-default-props:yes; 	font-size:10.0pt; 	mso-ansi-font-size:10.0pt; 	mso-bidi-font-size:10.0pt;} @page Section1 	{size:612.0pt 792.0pt; 	margin:70.85pt 3.0cm 70.85pt 3.0cm; 	mso-header-margin:36.0pt; 	mso-footer-margin:36.0pt; 	mso-paper-source:0;} div.Section1 	{page:Section1;} --><!--[if gte mso 10]> <mce:style><!   /* Style Definitions */  table.MsoNormalTable 	{mso-style-name:"Tabla normal"; 	mso-tstyle-rowband-size:0; 	mso-tstyle-colband-size:0; 	mso-style-noshow:yes; 	mso-style-priority:99; 	mso-style-qformat:yes; 	mso-style-parent:""; 	mso-padding-alt:0cm 5.4pt 0cm 5.4pt; 	mso-para-margin:0cm; 	mso-para-margin-bottom:.0001pt; 	mso-pagination:widow-orphan; 	font-size:11.0pt; 	font-family:"Calibri","sans-serif"; 	mso-ascii-font-family:Calibri; 	mso-ascii-theme-font:minor-latin; 	mso-fareast-font-family:"Times New Roman"; 	mso-fareast-theme-font:minor-fareast; 	mso-hansi-font-family:Calibri; 	mso-hansi-theme-font:minor-latin; 	mso-bidi-font-family:"Times New Roman"; 	mso-bidi-theme-font:minor-bidi;} --> <!--[endif]--></p>
<p class="MsoNormal" style="text-align: justify;"><span style="color: black;">Como vemos al usar el operador +=<span> </span>podemos indicarle<span> </span>al metodo delegado que va a contener mas metodos y cuando este se le llame nuestro objeto delegado va a llamar a todos los metodos contenidos</span></p>
<p class="MsoNormal" style="text-align: justify;">
<p class="MsoNormal" style="text-align: justify;"><!--[if gte mso 9]><xml> <w:WordDocument> <w:View>Normal</w:View> <w:Zoom>0</w:Zoom> <w:TrackMoves /> <w:TrackFormatting /> <w:HyphenationZone>21</w:HyphenationZone> <w:PunctuationKerning /> <w:ValidateAgainstSchemas /> <w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid> <w:IgnoreMixedContent>false</w:IgnoreMixedContent> <w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText> <w:DoNotPromoteQF /> <w:LidThemeOther>ES-CR</w:LidThemeOther> <w:LidThemeAsian>X-NONE</w:LidThemeAsian> <w:LidThemeComplexScript>X-NONE</w:LidThemeComplexScript> <w:Compatibility> <w:BreakWrappedTables /> <w:SnapToGridInCell /> <w:WrapTextWithPunct /> <w:UseAsianBreakRules /> <w:DontGrowAutofit /> <w:SplitPgBreakAndParaMark /> <w:DontVertAlignCellWithSp /> <w:DontBreakConstrainedForcedTables /> <w:DontVertAlignInTxbx /> <w:Word11KerningPairs /> <w:CachedColBalance /> </w:Compatibility> <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel> <m:mathPr> <m:mathFont m:val="Cambria Math" /> <m:brkBin m:val="before" /> <m:brkBinSub m:val=" " /> <m:smallFrac m:val="off" /> <m:dispDef /> <m:lMargin m:val="0" /> <m:rMargin m:val="0" /> <m:defJc m:val="centerGroup" /> <m:wrapIndent m:val="1440" /> <m:intLim m:val="subSup" /> <m:naryLim m:val="undOvr" /> </m:mathPr></w:WordDocument> </xml><![endif]--><!--[if gte mso 9]><xml> <w:LatentStyles DefLockedState="false" DefUnhideWhenUsed="true"   DefSemiHidden="true" DefQFormat="false" DefPriority="99"   LatentStyleCount="267"> <w:LsdException Locked="false" Priority="0" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="Normal" /> <w:LsdException Locked="false" Priority="9" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="heading 1" /> <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 2" /> <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 3" /> <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 4" /> <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 5" /> <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 6" /> <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 7" /> <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 8" /> <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 9" /> <w:LsdException Locked="false" Priority="39" Name="toc 1" /> <w:LsdException Locked="false" Priority="39" Name="toc 2" /> <w:LsdException Locked="false" Priority="39" Name="toc 3" /> <w:LsdException Locked="false" Priority="39" Name="toc 4" /> <w:LsdException Locked="false" Priority="39" Name="toc 5" /> <w:LsdException Locked="false" Priority="39" Name="toc 6" /> <w:LsdException Locked="false" Priority="39" Name="toc 7" /> <w:LsdException Locked="false" Priority="39" Name="toc 8" /> <w:LsdException Locked="false" Priority="39" Name="toc 9" /> <w:LsdException Locked="false" Priority="35" QFormat="true" Name="caption" /> <w:LsdException Locked="false" Priority="10" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="Title" /> <w:LsdException Locked="false" Priority="1" Name="Default Paragraph Font" /> <w:LsdException Locked="false" Priority="11" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="Subtitle" /> <w:LsdException Locked="false" Priority="22" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="Strong" /> <w:LsdException Locked="false" Priority="20" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="Emphasis" /> <w:LsdException Locked="false" Priority="59" SemiHidden="false"    UnhideWhenUsed="false" Name="Table Grid" /> <w:LsdException Locked="false" UnhideWhenUsed="false" Name="Placeholder Text" /> <w:LsdException Locked="false" Priority="1" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="No Spacing" /> <w:LsdException Locked="false" Priority="60" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Shading" /> <w:LsdException Locked="false" Priority="61" SemiHidden="false"    UnhideWhenUsed="false" Name="Light List" /> <w:LsdException Locked="false" Priority="62" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Grid" /> <w:LsdException Locked="false" Priority="63" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 1" /> <w:LsdException Locked="false" Priority="64" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 2" /> <w:LsdException Locked="false" Priority="65" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 1" /> <w:LsdException Locked="false" Priority="66" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 2" /> <w:LsdException Locked="false" Priority="67" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 1" /> <w:LsdException Locked="false" Priority="68" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 2" /> <w:LsdException Locked="false" Priority="69" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 3" /> <w:LsdException Locked="false" Priority="70" SemiHidden="false"    UnhideWhenUsed="false" Name="Dark List" /> <w:LsdException Locked="false" Priority="71" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Shading" /> <w:LsdException Locked="false" Priority="72" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful List" /> <w:LsdException Locked="false" Priority="73" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Grid" /> <w:LsdException Locked="false" Priority="60" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Shading Accent 1" /> <w:LsdException Locked="false" Priority="61" SemiHidden="false"    UnhideWhenUsed="false" Name="Light List Accent 1" /> <w:LsdException Locked="false" Priority="62" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Grid Accent 1" /> <w:LsdException Locked="false" Priority="63" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 1 Accent 1" /> <w:LsdException Locked="false" Priority="64" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 2 Accent 1" /> <w:LsdException Locked="false" Priority="65" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 1 Accent 1" /> <w:LsdException Locked="false" UnhideWhenUsed="false" Name="Revision" /> <w:LsdException Locked="false" Priority="34" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="List Paragraph" /> <w:LsdException Locked="false" Priority="29" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="Quote" /> <w:LsdException Locked="false" Priority="30" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="Intense Quote" /> <w:LsdException Locked="false" Priority="66" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 2 Accent 1" /> <w:LsdException Locked="false" Priority="67" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 1 Accent 1" /> <w:LsdException Locked="false" Priority="68" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 2 Accent 1" /> <w:LsdException Locked="false" Priority="69" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 3 Accent 1" /> <w:LsdException Locked="false" Priority="70" SemiHidden="false"    UnhideWhenUsed="false" Name="Dark List Accent 1" /> <w:LsdException Locked="false" Priority="71" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Shading Accent 1" /> <w:LsdException Locked="false" Priority="72" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful List Accent 1" /> <w:LsdException Locked="false" Priority="73" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Grid Accent 1" /> <w:LsdException Locked="false" Priority="60" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Shading Accent 2" /> <w:LsdException Locked="false" Priority="61" SemiHidden="false"    UnhideWhenUsed="false" Name="Light List Accent 2" /> <w:LsdException Locked="false" Priority="62" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Grid Accent 2" /> <w:LsdException Locked="false" Priority="63" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 1 Accent 2" /> <w:LsdException Locked="false" Priority="64" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 2 Accent 2" /> <w:LsdException Locked="false" Priority="65" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 1 Accent 2" /> <w:LsdException Locked="false" Priority="66" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 2 Accent 2" /> <w:LsdException Locked="false" Priority="67" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 1 Accent 2" /> <w:LsdException Locked="false" Priority="68" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 2 Accent 2" /> <w:LsdException Locked="false" Priority="69" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 3 Accent 2" /> <w:LsdException Locked="false" Priority="70" SemiHidden="false"    UnhideWhenUsed="false" Name="Dark List Accent 2" /> <w:LsdException Locked="false" Priority="71" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Shading Accent 2" /> <w:LsdException Locked="false" Priority="72" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful List Accent 2" /> <w:LsdException Locked="false" Priority="73" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Grid Accent 2" /> <w:LsdException Locked="false" Priority="60" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Shading Accent 3" /> <w:LsdException Locked="false" Priority="61" SemiHidden="false"    UnhideWhenUsed="false" Name="Light List Accent 3" /> <w:LsdException Locked="false" Priority="62" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Grid Accent 3" /> <w:LsdException Locked="false" Priority="63" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 1 Accent 3" /> <w:LsdException Locked="false" Priority="64" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 2 Accent 3" /> <w:LsdException Locked="false" Priority="65" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 1 Accent 3" /> <w:LsdException Locked="false" Priority="66" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 2 Accent 3" /> <w:LsdException Locked="false" Priority="67" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 1 Accent 3" /> <w:LsdException Locked="false" Priority="68" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 2 Accent 3" /> <w:LsdException Locked="false" Priority="69" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 3 Accent 3" /> <w:LsdException Locked="false" Priority="70" SemiHidden="false"    UnhideWhenUsed="false" Name="Dark List Accent 3" /> <w:LsdException Locked="false" Priority="71" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Shading Accent 3" /> <w:LsdException Locked="false" Priority="72" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful List Accent 3" /> <w:LsdException Locked="false" Priority="73" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Grid Accent 3" /> <w:LsdException Locked="false" Priority="60" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Shading Accent 4" /> <w:LsdException Locked="false" Priority="61" SemiHidden="false"    UnhideWhenUsed="false" Name="Light List Accent 4" /> <w:LsdException Locked="false" Priority="62" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Grid Accent 4" /> <w:LsdException Locked="false" Priority="63" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 1 Accent 4" /> <w:LsdException Locked="false" Priority="64" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 2 Accent 4" /> <w:LsdException Locked="false" Priority="65" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 1 Accent 4" /> <w:LsdException Locked="false" Priority="66" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 2 Accent 4" /> <w:LsdException Locked="false" Priority="67" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 1 Accent 4" /> <w:LsdException Locked="false" Priority="68" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 2 Accent 4" /> <w:LsdException Locked="false" Priority="69" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 3 Accent 4" /> <w:LsdException Locked="false" Priority="70" SemiHidden="false"    UnhideWhenUsed="false" Name="Dark List Accent 4" /> <w:LsdException Locked="false" Priority="71" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Shading Accent 4" /> <w:LsdException Locked="false" Priority="72" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful List Accent 4" /> <w:LsdException Locked="false" Priority="73" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Grid Accent 4" /> <w:LsdException Locked="false" Priority="60" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Shading Accent 5" /> <w:LsdException Locked="false" Priority="61" SemiHidden="false"    UnhideWhenUsed="false" Name="Light List Accent 5" /> <w:LsdException Locked="false" Priority="62" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Grid Accent 5" /> <w:LsdException Locked="false" Priority="63" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 1 Accent 5" /> <w:LsdException Locked="false" Priority="64" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 2 Accent 5" /> <w:LsdException Locked="false" Priority="65" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 1 Accent 5" /> <w:LsdException Locked="false" Priority="66" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 2 Accent 5" /> <w:LsdException Locked="false" Priority="67" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 1 Accent 5" /> <w:LsdException Locked="false" Priority="68" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 2 Accent 5" /> <w:LsdException Locked="false" Priority="69" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 3 Accent 5" /> <w:LsdException Locked="false" Priority="70" SemiHidden="false"    UnhideWhenUsed="false" Name="Dark List Accent 5" /> <w:LsdException Locked="false" Priority="71" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Shading Accent 5" /> <w:LsdException Locked="false" Priority="72" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful List Accent 5" /> <w:LsdException Locked="false" Priority="73" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Grid Accent 5" /> <w:LsdException Locked="false" Priority="60" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Shading Accent 6" /> <w:LsdException Locked="false" Priority="61" SemiHidden="false"    UnhideWhenUsed="false" Name="Light List Accent 6" /> <w:LsdException Locked="false" Priority="62" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Grid Accent 6" /> <w:LsdException Locked="false" Priority="63" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 1 Accent 6" /> <w:LsdException Locked="false" Priority="64" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 2 Accent 6" /> <w:LsdException Locked="false" Priority="65" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 1 Accent 6" /> <w:LsdException Locked="false" Priority="66" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 2 Accent 6" /> <w:LsdException Locked="false" Priority="67" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 1 Accent 6" /> <w:LsdException Locked="false" Priority="68" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 2 Accent 6" /> <w:LsdException Locked="false" Priority="69" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 3 Accent 6" /> <w:LsdException Locked="false" Priority="70" SemiHidden="false"    UnhideWhenUsed="false" Name="Dark List Accent 6" /> <w:LsdException Locked="false" Priority="71" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Shading Accent 6" /> <w:LsdException Locked="false" Priority="72" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful List Accent 6" /> <w:LsdException Locked="false" Priority="73" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Grid Accent 6" /> <w:LsdException Locked="false" Priority="19" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="Subtle Emphasis" /> <w:LsdException Locked="false" Priority="21" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="Intense Emphasis" /> <w:LsdException Locked="false" Priority="31" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="Subtle Reference" /> <w:LsdException Locked="false" Priority="32" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="Intense Reference" /> <w:LsdException Locked="false" Priority="33" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="Book Title" /> <w:LsdException Locked="false" Priority="37" Name="Bibliography" /> <w:LsdException Locked="false" Priority="39" QFormat="true" Name="TOC Heading" /> </w:LatentStyles> </xml><![endif]--> <!--[if gte mso 10]><br />
<mce:style><!   /* Style Definitions */  table.MsoNormalTable 	{mso-style-name:"Tabla normal"; 	mso-tstyle-rowband-size:0; 	mso-tstyle-colband-size:0; 	mso-style-noshow:yes; 	mso-style-priority:99; 	mso-style-qformat:yes; 	mso-style-parent:""; 	mso-padding-alt:0cm 5.4pt 0cm 5.4pt; 	mso-para-margin:0cm; 	mso-para-margin-bottom:.0001pt; 	mso-pagination:widow-orphan; 	font-size:11.0pt; 	font-family:"Calibri","sans-serif"; 	mso-ascii-font-family:Calibri; 	mso-ascii-theme-font:minor-latin; 	mso-fareast-font-family:"Times New Roman"; 	mso-fareast-theme-font:minor-fareast; 	mso-hansi-font-family:Calibri; 	mso-hansi-theme-font:minor-latin; 	mso-bidi-font-family:"Times New Roman"; 	mso-bidi-theme-font:minor-bidi;} --></p>
<p><!--[endif]--></p>
<p class="MsoNormal" style="text-align: justify;"><strong><span style="color: black;"><br />
</span></strong></p>
<p class="MsoNormal" style="text-align: justify;">
<p class="MsoNormal" style="text-align: justify;">
]]></content:encoded>
			<wfw:commentRss>http://www.blog.qui-mera.net/?feed=rss2&amp;p=42</wfw:commentRss>
		</item>
		<item>
		<title>Apuntes sobre C# valores por referencia</title>
		<link>http://www.blog.qui-mera.net/?p=50</link>
		<comments>http://www.blog.qui-mera.net/?p=50#comments</comments>
		<pubDate>Sat, 29 Nov 2008 01:13:11 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[.Net]]></category>

		<category><![CDATA[c#]]></category>

		<guid isPermaLink="false">http://www.blog.qui-mera.net/?p=50</guid>
		<description><![CDATA[Introduccion 
En nuestras aplicaciones a veces ocupamos cambiar los valores de una propiedad desde otra clase, en c++ con el manejo engorroso de punteros se podian hacer marravillas delegando a otras clases o metodos, pero insisto a veces es dificil controlar el manejo de punteros dentro de una clase

En .net el manejo de punteros se [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Introduccion </strong></p>
<p>En nuestras aplicaciones a veces ocupamos cambiar los valores de una propiedad desde otra clase, en c++ con el manejo engorroso de punteros se podian hacer marravillas delegando a otras clases o metodos, pero insisto a veces es dificil controlar el manejo de punteros dentro de una clase</p>
<p><span id="more-50"></span></p>
<p>En .net el manejo de punteros se considera como codigo inseguro, por lo cual no lo recomiendan, pero para esto definieron  una forma de pasar valores por referencia a los metodos, ya que por defecto los valores se pasan por valor y no por referencia.</p>
<p>Existen dos formas de pasar por referencia como parametro, se utilizan la instruccion <strong>out </strong>y la instruccion <strong>ref</strong> de la siguiente manera.</p>
<p>valorderetorno nombreDelMetodo(<strong>ref</strong> tipo nombreparametro)</p>
<p>o</p>
<p>valorderetorno nombreDelMetodo(<strong>out</strong> tipo nombreparametro)</p>
<p>como ejemplo seria algo asi</p>

<div class="wp_syntax"><div class="code"><pre class="java java" style="font-family:monospace;"> <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> setValue<span style="color: #009900;">&#40;</span>ref <span style="color: #003399;">String</span> id<span style="color: #009900;">&#41;</span>
 <span style="color: #009900;">&#123;</span>
  .......
 <span style="color: #009900;">&#125;</span>
 <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> setValue<span style="color: #009900;">&#40;</span>out <span style="color: #003399;">String</span> id<span style="color: #009900;">&#41;</span>
 <span style="color: #009900;">&#123;</span>
  ......
 <span style="color: #009900;">&#125;</span></pre></div></div>

<p>El compilador no va a identificar si es ref o out, este no conoce la diferencia pero para nosotros cuando usemos <strong>ref </strong>la variable tiene que estar inicializada y <strong>out </strong>no lo necesita.</p>
<p>un ejemplo de esto seria</p>

<div class="wp_syntax"><div class="code"><pre class="java java" style="font-family:monospace;">using <span style="color: #003399;">System</span>;
using <span style="color: #003399;">System</span>.<span style="color: #003399;">Collections</span>.<span style="color: #006633;">Generic</span>;
using <span style="color: #003399;">System</span>.<span style="color: #006633;">Text</span>;
&nbsp;
namespace Referencias
<span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">class</span> ChangeValues
    <span style="color: #009900;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> changeWithRef<span style="color: #009900;">&#40;</span>ref <span style="color: #000066; font-weight: bold;">int</span> b, <span style="color: #000066; font-weight: bold;">int</span> c<span style="color: #009900;">&#41;</span>
        <span style="color: #009900;">&#123;</span>
            b <span style="color: #339933;">=</span> c;
        <span style="color: #009900;">&#125;</span>
&nbsp;
        <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> changeWithOut<span style="color: #009900;">&#40;</span>out  <span style="color: #000066; font-weight: bold;">int</span> b, <span style="color: #000066; font-weight: bold;">int</span> c<span style="color: #009900;">&#41;</span>
        <span style="color: #009900;">&#123;</span>
            b <span style="color: #339933;">=</span> c;
        <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>y  el metodo main seria algo asi</p>

<div class="wp_syntax"><div class="code"><pre class="java java" style="font-family:monospace;">using <span style="color: #003399;">System</span>;
using <span style="color: #003399;">System</span>.<span style="color: #003399;">Collections</span>.<span style="color: #006633;">Generic</span>;
using <span style="color: #003399;">System</span>.<span style="color: #006633;">Text</span>;
&nbsp;
namespace Referencias
<span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">class</span> Program
    <span style="color: #009900;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000066; font-weight: bold;">void</span> Main<span style="color: #009900;">&#40;</span>string<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> args<span style="color: #009900;">&#41;</span>
        <span style="color: #009900;">&#123;</span>
            <span style="color: #000066; font-weight: bold;">int</span> a<span style="color: #339933;">=</span><span style="color: #cc66cc;">10</span>;
            <span style="color: #000066; font-weight: bold;">int</span> b;
            <span style="color: #003399;">System</span>.<span style="color: #006633;">Console</span>.<span style="color: #006633;">WriteLine</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;El valor de a es {0}&quot;</span>, a<span style="color: #009900;">&#41;</span>;
            ChangeValues change <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> ChangeValues<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
            change.<span style="color: #006633;">changeWithRef</span><span style="color: #009900;">&#40;</span>ref a,<span style="color: #cc66cc;">15</span><span style="color: #009900;">&#41;</span>;
            change.<span style="color: #006633;">changeWithOut</span><span style="color: #009900;">&#40;</span>out b, <span style="color: #cc66cc;">10</span><span style="color: #009900;">&#41;</span>;
            <span style="color: #003399;">System</span>.<span style="color: #006633;">Console</span>.<span style="color: #006633;">WriteLine</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Ahora el valor de a es {0}&quot;</span>,a<span style="color: #009900;">&#41;</span>;
            <span style="color: #003399;">System</span>.<span style="color: #006633;">Console</span>.<span style="color: #006633;">WriteLine</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;El valor de b es {0}&quot;</span>, b<span style="color: #009900;">&#41;</span>;
            Console.<span style="color: #006633;">ReadKey</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
&nbsp;
        <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>como vemos cuando la clase va a llamar a los metodos tenemos tambien que indicarle que los parametros van a pasar por referencia, sino el compilador nos mandara la exception.</p>
<p><a href="http://www.blog.qui-mera.net/descargas/Referencias.rar">codigo de ejemplo</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.blog.qui-mera.net/?feed=rss2&amp;p=50</wfw:commentRss>
		</item>
		<item>
		<title>Introduccion Hilos (Thread) en java</title>
		<link>http://www.blog.qui-mera.net/?p=26</link>
		<comments>http://www.blog.qui-mera.net/?p=26#comments</comments>
		<pubDate>Tue, 11 Nov 2008 00:25:47 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[java]]></category>

		<guid isPermaLink="false">http://www.blog.qui-mera.net/?p=26</guid>
		<description><![CDATA[Introducción
 
A veces necesitamos ejecutar tareas secundarias dentro de una aplicación que no interfieran con las tareas principales, Java da la oportunidad de realizar estas tareas en forma independiente, esto se le conoce como hilos. Nuestra aplicación corre sobre un hilo principal al cual podemos integrarle mas hilos que corren detrás de la aplicación

 
Cada [...]]]></description>
			<content:encoded><![CDATA[<p class="MsoNormal"><strong><span style="color: black;">Introducción</span></strong></p>
<p class="MsoNormal"><span style="color: black;"> </span></p>
<p class="MsoNormal" style="text-align: justify; text-indent: 35.4pt;"><span style="color: black;">A veces necesitamos<span> </span>ejecutar tareas secundarias dentro de una aplicación que no interfieran con las tareas principales, Java da la oportunidad de realizar estas tareas en forma independiente, esto se le conoce como hilos. Nuestra aplicación corre sobre un hilo principal al cual podemos integrarle mas hilos que corren detrás de la aplicación</span></p>
<p class="MsoNormal" style="text-align: justify; text-indent: 35.4pt;"><span id="more-26"></span></p>
<p class="MsoNormal" style="text-align: justify; text-indent: 35.4pt;"><span style="color: black;"> </span></p>
<p class="MsoNormal" style="text-align: justify; text-indent: 35.4pt;"><span style="color: black;">Cada hilo se programa como si ejecutara solo; como si la CPU fuera una sola. Algún mecanismo del sistema operativo esta dividiendo el tiempo de la CPU para la aplicación, esto que hace la programación de múltiples hilos una tarea mucho mas fácil.</span></p>
<p class="MsoNormal" style="text-align: justify; text-indent: 35.4pt;"><span style="color: black;"> </span></p>
<p class="MsoNormal" style="text-align: justify; text-indent: 35.4pt;"><span style="color: black;"><span> </span>Un proceso son instrucciones al CPU que<span> </span>se ejecuta en su propio espacio. Un sistema operativo multitarea es capas de ejecutar mas de un proceso<span> </span>a la vez, haciendo que parezca que cada uno esta por su cuenta, proporcionando periódicamente ciclos de CPU para cada proceso. Un hilo es un solo flujo de control dentro de un proceso. Un solo proceso puede tener múltiples hilos ejecutándose al mismo tiempo. En resumen un proceso puede contener múltiples hilos</span></p>
<p class="MsoNormal" style="text-align: justify; text-indent: 35.4pt;"><span style="color: black;"><span> </span></span></p>
<p class="MsoNormal" style="text-align: justify; text-indent: 35.4pt;"><span style="color: black;"><span> </span>Hay muchos usos posibles para la multitarea, pero en general, se tendrá una parte de un programa colgado por un evento en particular o recurso, y no se quiere colgar el resto del programa a causa de esto. Así es que se crea un hilo asociado con ese evento o recurso y se deja correr independientemente del programa principal. Un buen ejemplo es un botón de “salida” -no se quiere estar forzado a sondear el botón de salida en cada parte de código que se escribe y de la misma forma se quiere que tenga una buena respuesta, como si fuera verificado regularmente. De hecho, uno de las razones convincentes de forma inmediata para la multitarea es producir una interfase de buena respuesta.</span></p>
<p class="MsoNormal" style="text-align: justify; text-indent: 35.4pt;"><span style="color: black;"> </span></p>
<p class="MsoNormal" style="text-align: justify; text-indent: 35.4pt;"><span style="color: black;"> </span></p>
<p class="MsoNormal" style="text-indent: 35.4pt;"><span style="color: black;"> </span></p>
<p class="MsoNormal" style="text-indent: 35.4pt;"><strong><span style="color: black;">Hilos en Java</span></strong></p>
<p class="MsoNormal" style="text-indent: 35.4pt;"><span style="color: black;"> </span></p>
<p class="MsoNormal" style="text-indent: 35.4pt;"><span style="color: black;">Existen dos formas de implementar un hilo en java, una de ellas es heredar de java.lang.Thread, al hacer esto debemos sobrescribir el método run(), dentro de este método debemos escribir el código que queremos que se ejecute en “background”</span></p>
<p class="MsoNormal" style="text-indent: 35.4pt;"><span style="color: black;">Por ejemplo este seria el código de una clase llamada hilo en el package “Thread”:</span></p>
<p><span style="color: black;"> </span></p>
<p><span style="color: black;"> </span></p>

<div class="wp_syntax"><div class="code"><pre class="java java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">package</span> <span style="color: #006699;">Thread</span>;
&nbsp;
  <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> hiloThread <span style="color: #000000; font-weight: bold;">extends</span> <span style="color: #003399;">Thread</span>
  <span style="color: #009900;">&#123;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> run<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">for</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> i<span style="color: #339933;">=</span>0;i<span style="color: #339933;">&amp;</span>lt;<span style="color: #cc66cc;">15</span>;i<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span>
        <span style="color: #009900;">&#123;</span>
           <span style="color: #000000; font-weight: bold;">try</span>
           <span style="color: #009900;">&#123;</span>
                <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">sleep</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">100</span><span style="color: #009900;">&#41;</span>;
                <span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span>”Yo soy “<span style="color: #339933;">+</span><span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">getName</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>;
           <span style="color: #009900;">&#125;</span>
           <span style="color: #000000; font-weight: bold;">catch</span><span style="color: #009900;">&#40;</span><span style="color: #003399;">InterruptedException</span> e<span style="color: #009900;">&#41;</span>
           <span style="color: #009900;">&#123;</span>
                  <span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span>”el hilo se cayo intentando dormir”<span style="color: #009900;">&#41;</span>;
           <span style="color: #009900;">&#125;</span>
        <span style="color: #009900;">&#125;</span>
     <span style="color: #009900;">&#125;</span>
&nbsp;
   <span style="color: #009900;">&#125;</span></pre></div></div>

<p><span style="color: black;"> </span></p>
<p><span style="color: black;"> </span></p>
<p class="MsoNormal" style="text-indent: 35.4pt;"><span style="color: black;">Notaran que se llama a una función llamada sleep(long<span> </span>args0) (hay que mencionar que sleep(long args0) puede causar una excepción InterruptedException ), esta función detiene el hilo, en este caso 100 milisegundos y también llamamos a una función getName()<span> </span>que devuelve obviamente el nombre del hilo.</span></p>
<p class="MsoNormal" style="text-indent: 35.4pt;"><span style="color: black;">Ahora este es el código del main para probar nuestro hilo </span></p>
<p class="MsoNormal" style="text-indent: 35.4pt;"><span style="color: black;"> </span></p>
<p class="MsoNormal" style="text-indent: 35.4pt;"><span style="color: black;"> </span></p>

<div class="wp_syntax"><div class="code"><pre class="java java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">package</span> <span style="color: #006699;">principal</span>;
&nbsp;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">Thread.hilo</span>;
&nbsp;
  <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> main
  <span style="color: #009900;">&#123;</span>
&nbsp;
     <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000066; font-weight: bold;">void</span> main<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> args<span style="color: #009900;">&#41;</span>
     <span style="color: #009900;">&#123;</span>
           hiloThread hil<span style="color: #339933;">=</span><span style="color: #000000; font-weight: bold;">new</span> hiloThread <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
           hiloThread hi2<span style="color: #339933;">=</span><span style="color: #000000; font-weight: bold;">new</span> hiloThread <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
           hiloThread hi3<span style="color: #339933;">=</span><span style="color: #000000; font-weight: bold;">new</span> hiloThread <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
           hil.<span style="color: #006633;">setName</span><span style="color: #009900;">&#40;</span>”hilo <span style="color: #cc66cc;">1</span>″<span style="color: #009900;">&#41;</span>;
           hi2.<span style="color: #006633;">setName</span><span style="color: #009900;">&#40;</span>”hilo <span style="color: #cc66cc;">2</span>″<span style="color: #009900;">&#41;</span>;
           hi3.<span style="color: #006633;">setName</span><span style="color: #009900;">&#40;</span>”hilo <span style="color: #cc66cc;">3</span>″<span style="color: #009900;">&#41;</span>;
           hil.<span style="color: #006633;">start</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
           hi2.<span style="color: #006633;">start</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
           hi3.<span style="color: #006633;">start</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
     <span style="color: #009900;">&#125;</span>
&nbsp;
  <span style="color: #009900;">&#125;</span></pre></div></div>

<p class="MsoNormal" style="text-indent: 35.4pt;"><span style="color: black;"> </span></p>
<p class="MsoNormal" style="text-indent: 35.4pt;"><span style="color: black;"> </span></p>
<p class="MsoNormal" style="text-indent: 35.4pt;"><span style="color: black;">Como notamos para iniciar el hilo no debemos llamar al método run que implementamos en nuestra clase sino vamos a llamar a un método start().Como ya he mencionado heredar de Thread convierte a la clase en un hilo, la otra forma que tiene java<span> </span>para implementar hilos es tener una clase con hilos adentro, para esto debemos implementar la interfaz java.lang.Runnable. Ahora intentaremos hacer un ejemplo parecido, este seria el código:</span></p>
<p class="MsoNormal" style="text-indent: 35.4pt;"><span style="color: black;"> </span></p>

<div class="wp_syntax"><div class="code"><pre class="java java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">package</span> <span style="color: #006699;">Thread</span>;
&nbsp;
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> hiloRunnable <span style="color: #000000; font-weight: bold;">implements</span> <span style="color: #003399;">Runnable</span>
<span style="color: #009900;">&#123;</span>
   <span style="color: #003399;">Thread</span> hilo;
   <span style="color: #000000; font-weight: bold;">public</span> hiloRunnable<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> name<span style="color: #009900;">&#41;</span>
   <span style="color: #009900;">&#123;</span>
         hilo<span style="color: #339933;">=</span><span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">Thread</span><span style="color: #009900;">&#40;</span>hiloRunnable.<span style="color: #000000; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>;
         hilo.<span style="color: #006633;">setName</span><span style="color: #009900;">&#40;</span>name<span style="color: #009900;">&#41;</span>;
   <span style="color: #009900;">&#125;</span>
   @Override
   <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> run<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
   <span style="color: #009900;">&#123;</span>
     <span style="color: #000000; font-weight: bold;">for</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> i<span style="color: #339933;">=</span>0;i<span style="color: #339933;">&amp;</span>lt;<span style="color: #cc66cc;">15</span>;i<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span>
     <span style="color: #009900;">&#123;</span>
       <span style="color: #000000; font-weight: bold;">try</span>
       <span style="color: #009900;">&#123;</span>
         hilo.<span style="color: #006633;">sleep</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">100</span><span style="color: #009900;">&#41;</span>;
         <span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Yo soy &quot;</span><span style="color: #339933;">+</span>hilo.<span style="color: #006633;">getName</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>;
       <span style="color: #009900;">&#125;</span>
       <span style="color: #000000; font-weight: bold;">catch</span><span style="color: #009900;">&#40;</span><span style="color: #003399;">InterruptedException</span> e<span style="color: #009900;">&#41;</span>
       <span style="color: #009900;">&#123;</span>
          <span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;el hilo se cayo intentando dormir&quot;</span><span style="color: #009900;">&#41;</span>;
       <span style="color: #009900;">&#125;</span>
     <span style="color: #009900;">&#125;</span>
&nbsp;
   <span style="color: #009900;">&#125;</span>
&nbsp;
   <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> start<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
   <span style="color: #009900;">&#123;</span>
      <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">hilo</span>.<span style="color: #006633;">start</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
&nbsp;
   <span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #009900;">&#125;</span></pre></div></div>

<p class="MsoNormal" style="text-indent: 35.4pt;"><span style="color: black;"> </span></p>
<p class="MsoNormal" style="text-indent: 35.4pt;"><span style="color: black;"> </span></p>
<p class="MsoNormal" style="text-indent: 35.4pt;"><span style="color: black;">Como vemos hemos construido un objeto<span> </span>de tipo Thread que el constructor recibe como parámetro una clase que implemente java.lang.Runnable, aparte hemos construido un metodo start() que llame al método <strong>this</strong>.hilo.start(); este seria el codigo del main </span></p>
<p class="MsoNormal" style="text-indent: 35.4pt;"><span style="color: black;"> </span></p>

<div class="wp_syntax"><div class="code"><pre class="java java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">package</span> <span style="color: #006699;">principal</span>;
&nbsp;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">Thread.hiloRunnable</span>;
&nbsp;
       <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> main
       <span style="color: #009900;">&#123;</span>
&nbsp;
           <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000066; font-weight: bold;">void</span> main<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> args <span style="color: #009900;">&#41;</span>
           <span style="color: #009900;">&#123;</span>
            <span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Implementando Runnable&quot;</span><span style="color: #009900;">&#41;</span>;
            hiloRunnable hil <span style="color: #339933;">=</span><span style="color: #000000; font-weight: bold;">new</span> hiloRunnable<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;hilo 1&quot;</span><span style="color: #009900;">&#41;</span>;
            hiloRunnable hi2 <span style="color: #339933;">=</span><span style="color: #000000; font-weight: bold;">new</span> hiloRunnable<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;hilo 2&quot;</span><span style="color: #009900;">&#41;</span>;
            hiloRunnable hi3 <span style="color: #339933;">=</span><span style="color: #000000; font-weight: bold;">new</span> hiloRunnable<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;hilo 3&quot;</span><span style="color: #009900;">&#41;</span>;
            hil.<span style="color: #006633;">start</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
            hi2.<span style="color: #006633;">start</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
            hi3.<span style="color: #006633;">start</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
           <span style="color: #009900;">&#125;</span>
        <span style="color: #009900;">&#125;</span></pre></div></div>

<p class="MsoNormal"><span style="color: black;"> </span></p>
<p class="MsoNormal" style="text-indent: 35.4pt;"><span style="color: black;"> </span></p>
<p class="MsoNormal" style="text-indent: 35.4pt;"><span style="color: black;">En un futuro post intentaremos trabajar con varios hilos al mismo tiempo, y resolver varios problemas como concurrencia y sincronización de hilos, aparte de hilos en .Net</span></p>
<p class="MsoNormal" style="text-indent: 35.4pt;"><a href="http://www.blog.qui-mera.net/descargas/thread.rar"><br />
</a></p>
<p class="MsoNormal" style="text-indent: 35.4pt;"><a href="http://www.blog.qui-mera.net/descargas/thread.rar">codigo de ejemplo</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.blog.qui-mera.net/?feed=rss2&amp;p=26</wfw:commentRss>
		</item>
		<item>
		<title>Introduccion a aplicaciones Distribuidas con Net</title>
		<link>http://www.blog.qui-mera.net/?p=24</link>
		<comments>http://www.blog.qui-mera.net/?p=24#comments</comments>
		<pubDate>Thu, 06 Nov 2008 18:19:46 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[.Net]]></category>

		<category><![CDATA[c#]]></category>

		<guid isPermaLink="false">http://www.blog.qui-mera.net/?p=24</guid>
		<description><![CDATA[En el  TIC LATIN FEST de la universidad latina  fui expositor de este tema asi que para que este a disposicion de los que fueron participes de esta charla aqui esta la presentacion y los ejemplos de .net Remoting que se usaron

presentacion y ejemplo
]]></description>
			<content:encoded><![CDATA[<p>En el  TIC LATIN FEST de la universidad latina  fui expositor de este tema asi que para que este a disposicion de los que fueron participes de esta charla aqui esta la presentacion y los ejemplos de .net Remoting que se usaron</p>
<p><span id="more-24"></span></p>
<p><a class="aligncenter" title="ejemplos y presentacion" href="http://www.blog.qui-mera.net/descargas/TIC2008.rar">presentacion y ejemplo</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.blog.qui-mera.net/?feed=rss2&amp;p=24</wfw:commentRss>
		</item>
		<item>
		<title>TIC&#8212; Latin Fest universidad latina</title>
		<link>http://www.blog.qui-mera.net/?p=19</link>
		<comments>http://www.blog.qui-mera.net/?p=19#comments</comments>
		<pubDate>Tue, 04 Nov 2008 00:07:07 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[General]]></category>

		<category><![CDATA[otros]]></category>

		<guid isPermaLink="false">http://www.blog.qui-mera.net/?p=19</guid>
		<description><![CDATA[apartir de mañana la universidad tendra varias actividades,
el jueves 3 a las 6 de la tarde estare dando una conferencia de aplicaciones distribuidas

]]></description>
			<content:encoded><![CDATA[<p>apartir de mañana la universidad tendra varias actividades,</p>
<p>el jueves 3 a las 6 de la tarde estare dando una conferencia de aplicaciones distribuidas</p>
<p><span id="more-19"></span></p>
<p><div class="wp-caption aligncenter" style="width: 433px"><img title="programa " src="http://www.blog.qui-mera.net/descargas/programa.jpg" alt="programa latin tic latin fest 2008" width="423" height="520" /><p class="wp-caption-text">programa latin tic latin fest 2008</p></div></p>
]]></content:encoded>
			<wfw:commentRss>http://www.blog.qui-mera.net/?feed=rss2&amp;p=19</wfw:commentRss>
		</item>
		<item>
		<title>Abrazen a un programador</title>
		<link>http://www.blog.qui-mera.net/?p=14</link>
		<comments>http://www.blog.qui-mera.net/?p=14#comments</comments>
		<pubDate>Tue, 21 Oct 2008 23:08:02 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[General]]></category>

		<category><![CDATA[otros]]></category>

		<guid isPermaLink="false">http://www.blog.qui-mera.net/?p=14</guid>
		<description><![CDATA[
El problema es que no es nada alejado de la realidad
]]></description>
			<content:encoded><![CDATA[<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="400" height="290" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="src" value="http://blip.tv/play/gYwjwZJqjdEh" /><embed type="application/x-shockwave-flash" width="400" height="290" src="http://blip.tv/play/gYwjwZJqjdEh"></embed></object></p>
<p>El problema es que no es nada alejado de la realidad</p>
]]></content:encoded>
			<wfw:commentRss>http://www.blog.qui-mera.net/?feed=rss2&amp;p=14</wfw:commentRss>
		</item>
		<item>
		<title>Introduccion a jquery</title>
		<link>http://www.blog.qui-mera.net/?p=5</link>
		<comments>http://www.blog.qui-mera.net/?p=5#comments</comments>
		<pubDate>Sat, 18 Oct 2008 01:07:45 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[frameworks]]></category>

		<category><![CDATA[javascript]]></category>

		<category><![CDATA[jquery]]></category>

		<guid isPermaLink="false">http://www.blog.qui-mera.net/?p=5</guid>
		<description><![CDATA[Uno de los Frameworks que han tenido una gran popularidad entre los desarrolladores y programadores de javascript. JQuery es una “librería JavaScript muy rápida y muy ligera que simplifica el desarrollo de la parte de cliente de las aplicaciones web”. En otras palabras, jQuery incluye muchas utilidades para crear fácilmente las páginas web de las aplicaciones dinámicas complejas.

Este post pretende ser una introducción a los métodos más básicos de jquery, en un futuro se trataran los plugins y/o añadidos a este framework.

Jquery se distribuye en dos versiones, la versión descomprimida un poco pesada y es la mejor opción para desarrollar aplicaciones. La versión comprimida la cual es la opción ideal en el servidor de producción, para minimizar el tiempo de carga de la aplicación.]]></description>
			<content:encoded><![CDATA[<p><strong>Introduccion</strong></p>
<p>Uno de los Frameworks que han tenido una gran popularidad entre los desarrolladores y programadores de javascript. JQuery es una “librería JavaScript muy rápida y muy ligera que simplifica el desarrollo de la parte de cliente de las aplicaciones web”. En otras palabras, jQuery incluye muchas utilidades para crear fácilmente las páginas web de las aplicaciones dinámicas complejas.</p>
<p>Este post pretende ser una introducción a los métodos más básicos de jquery, en un futuro se trataran los plugins y/o añadidos a este framework.</p>
<p><span id="more-5"></span></p>
<p>Jquery se distribuye en dos versiones, la versión descomprimida un poco pesada y es la mejor opción para desarrollar aplicaciones. La versión comprimida la cual es la opción ideal en el servidor de producción, para minimizar el tiempo de carga de la aplicación.</p>
<p><strong>Caracteristicas</strong></p>
<p>* DOM interactividad y modificaciones, (incluyendo soporte para CSS 1-3 y un Plugin Básico de XPath)<br />
* Manejo de Eventos<br />
* Efectos y Animaciones<br />
* Ajax y JSon<br />
* Extensibilidad (es extendible por medio plugins)<br />
* Plugins Javascript</p>
<p><strong>Instalacion</strong></p>
<p>Simplemente incluiremos esta etiqueta dentro del head de nuestro documento html</p>
<p>&lt;script type=”text/javascript” src=”jquery.js”&gt;&lt;/script&gt;</p>
<p>El corazon de Jquery</p>
<p>El corazon de jquery es la funcion $, la funcion recibe como parametro un string y devuelve un objeto sea un array objetos html o un objecto html segun el query que se envie por parametro, la forma de utilizarlo es de la siguiente manera.</p>
<p>$(elemento).evento_o_metodo(funcion-o-parametro);</p>
<p><strong>Selectores Simples</strong></p>
<p>La forma de elegir los elementos DOM de una pagina jquery propone usar la funcion $ de la<br />
siguiente manera</p>
<p>$(elemento) para propias html<br />
$(#elemento) para identificadores, (id=”&#8221;) de etiquetas html<br />
$(.elemento) para atributos(class) CSS.</p>
<p><strong>Selectores avanzados</strong></p>
<p>Jquery permite no solo seleccionar un solo elemento o un conjunto de elementos con una misma<br />
caracteristica ademas incluye la seleccion de varios elementos con diferentes atributos de<br />
de la siguiente manera</p>
<p>$(”div,span,p.myClass”)</p>
<p>como ven la sintaxis para realizar esta seleccion es incluir comas entre los elementos<br />
Efectos</p>
<p>Jquery incluye diferentes efectos que se detallaran</p>
<p>Show (Mostrar)<br />
Modifica los atributos alto, ancho y transparencia partiendo de 0.</p>
<p>$(objeto).show(”velocidad”)<br />
Velocidad: Determina el tiempo en el que se realizará el efecto. Puede ser “slow” (lento), “normal”, o “fast” (rápido).</p>
<p>$(objeto).hide(”velocidad”)<br />
Modifica los atributos alto, ancho y transparencia, partiendo de los valores actuales hasta llegar a 0.</p>
<p>$(objeto).slideDown(”velocidad”)<br />
Modifica los atributos alto y transparencia, partiendo de 0. Es similar a “show”, salvo que no modifica el ancho, creando un efecto de “cortinilla”.</p>
<p>$(objeto).slideUp(”velocidad”)<br />
Modifica los atributos alto y transparencia, partiendo de los actuales, hasta llegar a 0. Es similar a “show”, salvo que no modifica el ancho, creando un efecto de “cortinilla”.</p>
<p>$(objeto).fadeIn(”velocidad”)<br />
Modifica el atributo transparencia desde 0.</p>
<p>$(objeto).fadeOut(”velocidad”)<br />
Modifica el atributo transparencia desde el valor actual, hasta llegar a 0.</p>
<p>$(objeto).center(”velocidad”);<br />
Centra un elemento con respecto a su “parent”.</p>
<p>$(objeto).fadeTo(”velocidad”, transparencia)<br />
Modifica el atributo transparencia a un valor especifico.</p>
<p>$(objeto).animate(”propiedades”,”velocidad”);<br />
Velocidad: Determina el tiempo en el que se realizará el efecto. Puede ser “slow” (lento), “normal”, o “fast” (rápido).<br />
Transparencia: Un numero de 0 a 100 que indica que tan visible es el elemento.</p>
<p>$(objeto).animate({width:20,height:200}, “slow”)<br />
Velocidad: Determina el tiempo en el que se realizará el efecto. Puede ser “slow” (lento), “normal”, o “fast” (rápido).<br />
Propiedades: Una o más propiedades con valor numérico en CSS, por ejemplo width y height.</p>
<p>tomado de http://www.cristalab.com/tutoriales/214/tutorial-de-jquery.html</p>
<p>Eventos</p>
<p>Jquery permite un manejo facil de eventos como por ejemplo el evento que muchos conoceran (window.onload = funcion) se hara de la siguiente manera</p>
<p>$(document).ready(function(){</p>
<p>});</p>
<p>Como vemos para controlar un evento en jquery usamos la siguiente sintaxis</p>
<p>$(”selector”).nombredelevento(funcion)</p>
<p>los eventos en jquery mas comunes son los siguietes:</p>
<p>blur( )</p>
<p>blur( fn )</p>
<p>change( )</p>
<p>change( fn ).</p>
<p>click( )</p>
<p>click( fn )</p>
<p>dblclick( )</p>
<p>dblclick( fn )</p>
<p>error( )</p>
<p>error( fn )</p>
<p>focus( )</p>
<p>keydown( )</p>
<p>keydown( fn )</p>
<p>keypress( )</p>
<p>keypress( fn )</p>
<p>keyup( )</p>
<p>keyup( fn )</p>
<p>load( fn )</p>
<p>mousedown( fn )</p>
<p>mousemove( fn )</p>
<p>mouseout( fn )</p>
<p>mouseover( fn )</p>
<p>resize( fn )</p>
<p>scroll( fn )</p>
<p>select( )</p>
<p>submit( )</p>
<p>submit( fn )</p>
<p>unload( fn )</p>
<p>Links de interes y bibliografia</p>
<p>http://docs.jquery.com/Main_Page</p>
<p>http://visualjquery.com/</p>
<p>http://www.cristalab.com/tutoriales/214/tutorial-de-jquery.html</p>
<p>http://es.wikipedia.org/wiki/JQuery</p>
<p>http://www.javascriptya.com.ar/jquery/</p>
]]></content:encoded>
			<wfw:commentRss>http://www.blog.qui-mera.net/?feed=rss2&amp;p=5</wfw:commentRss>
		</item>
		<item>
		<title>El inicio</title>
		<link>http://www.blog.qui-mera.net/?p=3</link>
		<comments>http://www.blog.qui-mera.net/?p=3#comments</comments>
		<pubDate>Tue, 07 Oct 2008 23:36:25 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[General]]></category>

		<category><![CDATA[otros]]></category>

		<guid isPermaLink="false">http://www.blog.qui-mera.net/?p=3</guid>
		<description><![CDATA[
Bueno nuevamente me e sentado a intentar hacer un blog&#8230; en intentos anteriores no he podido formalizar un blog&#8230;&#8230;
asi q en este intento de blog intentaremos cubrir diferentes tegnologias tanto de java a .net pasando por otras de mi interes
]]></description>
			<content:encoded><![CDATA[<p style="text-align: center;"><img class="aligncenter" src="http://blog.manu-bd.info/images/Monstres/MiGeek-MiOtaku.jpg" alt="Geek" /></p>
<p>Bueno nuevamente me e sentado a intentar hacer un blog&#8230; en intentos anteriores no he podido formalizar un blog&#8230;&#8230;</p>
<p>asi q en este intento de blog intentaremos cubrir diferentes tegnologias tanto de java a .net pasando por otras de mi interes</p>
]]></content:encoded>
			<wfw:commentRss>http://www.blog.qui-mera.net/?feed=rss2&amp;p=3</wfw:commentRss>
		</item>
	</channel>
</rss>
