C# Programming - Functions and Subroutines - Discussion

Discussion :: Functions and Subroutines - General Questions (Q.No.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?

static void fun(object i)
{ ... }
static void fun(int i)
{ ... }
static void fun(double i, int j)
{ ... }
static void fun(int i, double j)
{ ... }
static void fun(int i, double j, )
{ ... }

Answer: Option A


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.