Concept of Functions in C#
using System;
public class functionOver
{
int sum;
public void add(int a,int b)
{
sum=a+b;
Console.Write("Sum is:"+sum);
}
public void add(int a,int b,int c)
{
sum=a+b+c;
Console.Write("Sum is:"+sum);
}
}
public class execute
{
public static void Main(String [] args)
{
functionOver f=new function();
f.add(2,4);
f.add(1,2,3);
Console.ReadLine();
}
}
public class functionOver
{
int sum;
public void add(int a,int b)
{
sum=a+b;
Console.Write("Sum is:"+sum);
}
public void add(int a,int b,int c)
{
sum=a+b+c;
Console.Write("Sum is:"+sum);
}
}
public class execute
{
public static void Main(String [] args)
{
functionOver f=new function();
f.add(2,4);
f.add(1,2,3);
Console.ReadLine();
}
}
No comments:
Post a Comment