using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace _6
{
public delegate int DelegateSample(int a,int b);
public class sampleclass
{
public int add(int x, int y)
{
return x + y;
}
public int sub(int x, int y)
{
return x - y;
}
class program {
static void Main(String[] args)
{
sampleclass s = new sampleclass();
DelegateSample del = s.add;
int i = del(10, 20);
Console.WriteLine("Add result is"+i);
DelegateSample del1 = s.sub;
int j = del1(10, 2);
Console.WriteLine("Sub result is" + j);
Console.ReadLine();
}
}
}
}
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace _6
{
public delegate int DelegateSample(int a,int b);
public class sampleclass
{
public int add(int x, int y)
{
return x + y;
}
public int sub(int x, int y)
{
return x - y;
}
class program {
static void Main(String[] args)
{
sampleclass s = new sampleclass();
DelegateSample del = s.add;
int i = del(10, 20);
Console.WriteLine("Add result is"+i);
DelegateSample del1 = s.sub;
int j = del1(10, 2);
Console.WriteLine("Sub result is" + j);
Console.ReadLine();
}
}
}
}
No comments:
Post a Comment