C# Programming - Delegates - Discussion

Discussion Forum : Delegates - General Questions (Q.No. 6)
6.
Which of the following is the correct way to call subroutine MyFun() of the Sample class given below?
class Sample
{
    public void MyFun(int i, Single j)
    {
        Console.WriteLine("Welcome to IndiaBIX !");
    }
}
delegate void del(int i);
Sample s = new Sample();
del d = new del(ref s.MyFun);
d(10, 1.1f);
delegate void del(int i, Single j);
del d;
Sample s = new Sample();
d = new del(ref s.MyFun);
d(10, 1.1f);
Sample s = new Sample();
delegate void d = new del(ref MyFun);
d(10, 1.1f);
delegate void del(int i, Single]);
Sample s = new Sample();
del = new delegate(ref MyFun);
del(10, 1.1f);
Answer: Option
Explanation:
No answer description is available. Let's discuss.
Discussion:
1 comments Page 1 of 1.

Andrue Cope said:   1 decade ago
What's with the use of 'ref' in this and the previous question?

Post your comments here:

Your comments will be displayed after verification.