1.

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 !"); } }

A. <pre><code class="csharp">delegate void del(int i); Sample s = new Sample(); del d = new del(ref s.MyFun); d(10, 1.1f);</code></pre>
B. <pre><code class="csharp">delegate void del(int i, Single j); del d; Sample s = new Sample(); d = new del(ref s.MyFun); d(10, 1.1f);</code></pre>
C. <pre><code class="csharp">Sample s = new Sample(); delegate void d = new del(ref MyFun); d(10, 1.1f);</code></pre>
D. <pre><code class="csharp">delegate void del(int i, Single]); Sample s = new Sample(); del = new delegate(ref MyFun); del(10, 1.1f);</code></pre>
Answer» C. <pre><code class="csharp">Sample s = new Sample(); delegate void d = new del(ref MyFun); d(10, 1.1f);</code></pre>


Discussion

No Comment Found

Related MCQs