Advertisement
Fhernd

thisUsoEnClase.cs

Jul 25th, 2014
691
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.60 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Articulos.Preguntas
  4. {
  5.     public class UsoThisEnClase
  6.     {
  7.         private int campo;
  8.        
  9.         public UsoThisEnClase(int valor)
  10.         {
  11.             this.campo = valor;
  12.         }
  13.        
  14.         public void Metodo(int a)
  15.         {
  16.             this.campo = a;
  17.            
  18.             this = new UsoThisEnClase(9);
  19.            
  20.             Console.WriteLine(campo.ToString());
  21.         }
  22.        
  23.         public static void Main()
  24.         {
  25.             UsoThisEnClase ut = new UsoThisEnClase(3);
  26.            
  27.             ut.Metodo(4);
  28.         }
  29.     }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement