Search This Blog

Wednesday, 11 September 2013

Concept of "This" operator...



Using "This" Operator

using System;

public class ThisClass
{
  int a,b;
 
  public void input(int a,int b)
  {
      this.a=a;
      this.b=b;
  }
 
  public void output()
  {
    int c;
    c=a+b;
    Console.WriteLine("Sum is:"+c);
  }   
 
}

public class ExecuteProgram
{
    public static void Main(String[] args)
    {
       ThisClass cl=new ThisClass();
       cl.input(3,7);
       cl.output();
       Console.ReadLine();
    }
}

Output



No comments:

Popular Posts