C# Programming - Functions and Subroutines - Discussion

Discussion :: Functions and Subroutines - General Questions (Q.No.17)

17. 

If a function fun() is to sometimes receive an int and sometimes a double then which of the following is the correct way of defining this function?

[A].
static void fun(object i)
{ ... }
[B].
static void fun(int i)
{ ... }
[C].
static void fun(double i, int j)
{ ... }
[D].
static void fun(int i, double j)
{ ... }
[E].
static void fun(int i, double j, )
{ ... }

Answer: Option A

Explanation:

No answer description available for this question.

Gopesh said: (Jun 28, 2012)  
We will first use boxing concept to convert int and double to change into object and after receiving we will use unboxing concept to change it into desired datatype.

Chamoda said: (Jul 16, 2018)  
Please, explain me the answer clearly.

Post your comments here:

Name *:

Email   : (optional)

» Your comments will be displayed only after manual approval.