Created
June 21, 2014 23:19
-
-
Save Fhernd/96caa28f153166d942e6 to your computer and use it in GitHub Desktop.
Intento de asignación de nueva instancia a this en un miembro función de una clase.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
namespace Articulos.Preguntas | |
{ | |
public class UsoThisEnClase | |
{ | |
private int campo; | |
public UsoThisEnClase(int valor) | |
{ | |
this.campo = valor; | |
} | |
public void Metodo(int a) | |
{ | |
this.campo = a; | |
this = new UsoThisEnClase(9); | |
Console.WriteLine(campo.ToString()); | |
} | |
public static void Main() | |
{ | |
UsoThisEnClase ut = new UsoThisEnClase(3); | |
ut.Metodo(4); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment