Answer Posted / m.shanmuga sundaram
using System;
using System.Collections.Generic;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
public delegate int execute(int a, int
b); //declare a delegate method
static void Main(string[] args)
{
Program p = new Program();
execute ex = new execute(p.add);
Console.WriteLine(ex(2,3)); //add method is
executed
ex = new execute(p.subtract);
Console.WriteLine(ex(2, 3)); //subtract method
is executed
}
public int add(int a, int b)
{
return (a + b);
}
public int subtract(int a, int b)
{
return (a - b);
}
}
}
Is This Answer Correct ? | 3 Yes | 0 No |
Post New Answer View All Answers
How do you prevent a class from being inherited in c#?
What is single dimensional array in c#?
How long can a string be c#?
What does out mean in c#?
What is mvc pattern in c#?
What is ispostback c#?
What is dataadapter c#?
What is semaphore in c#?
how to insert the data from the grid view to database table though button click.pls send the answer to mail id suri1319@gmail.com
What is the and operator in c#?
Why is main static in c#?
What are the types of constructors?
What is datareader c#?
What are examples of desktop applications?
What is console writeline in c#?