Tuesday, 23 October 2012

Program to demonstrate the use of alias in C#


using print=System.Console;
class A
{
 int b;
 void Sum(int x)
 {
  b=x;
  b=b+b;
  print.WriteLine(b);
 }
 static void Main(String[] arg)
 {
  float a,num;
  a=float.Parse(arg[0]);
  num=float.Parse(arg[1]);
  A obj=new A();
  string name="Amit Ranjan";
  obj.b=12;
  print.WriteLine("WELCOME in C# {0} {1} ",arg[0]+arg[1],num+a);
  obj.Sum(obj.b);
  print.ReadKey();
 }
}

Output:-

No comments:

Post a Comment