adplus-dvertising
frame-decoration

Question

Which of the following is the correct way to call the subroutine function abc() of the given class csharp given below?
class csharp
{
    void abc()
    {
        console.writeline("A:Just do it!");
    }
}

a.

csharp c = new csharp();
delegate void d = new del(ref abc);
d();

b.

delegate void del();
del d;
csharp s = new csharp();
d = new del(ref s.abc);
d();

c.

csharp s = new csharp();
delegate void del = new delegate(ref abc);
del();

d.

None of the mentioned

Posted under C# programming

Answer: (b).delegate void del();
del d;
csharp s = new csharp();
d = new del(ref s.abc);
d();

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

Q. Which of the following is the correct way to call the subroutine function abc() of the given class csharp given below?