Notes:-
1.Cannot use "this".
2.If any instance is created ,we can't access the static methods,fields,members,..
3.Constants are implicitly static
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace conStatic
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("// For Static ");
Console.WriteLine(Cal.mul(23, 43).ToString());
Console.WriteLine("// ordinary method");
Cal obj = new Cal();
Console.WriteLine(obj.adder(65, 23).ToString());
Console.ReadLine();
}
}
public class Cal
{
public static int x;
public static int y;
public int adder(int x, int y) //we cannot use "this" operator
{
return x + y;
}
public static int mul(int x, int y)
{
return x * y;
}
}
}
// In case any points need to be added Post it in Comments
//Karthik
1.Cannot use "this".
2.If any instance is created ,we can't access the static methods,fields,members,..
3.Constants are implicitly static
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace conStatic
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("// For Static ");
Console.WriteLine(Cal.mul(23, 43).ToString());
Console.WriteLine("// ordinary method");
Cal obj = new Cal();
Console.WriteLine(obj.adder(65, 23).ToString());
Console.ReadLine();
}
}
public class Cal
{
public static int x;
public static int y;
public int adder(int x, int y) //we cannot use "this" operator
{
return x + y;
}
public static int mul(int x, int y)
{
return x * y;
}
}
}
// In case any points need to be added Post it in Comments
//Karthik
No comments:
Post a Comment