C# Programming - Functions and Subroutines - Discussion

Discussion Forum : 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?
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
Explanation:
No answer description is available. Let's discuss.
Discussion:
2 comments Page 1 of 1.

Chamoda said:   7 years ago
Please, explain me the answer clearly.

Gopesh said:   1 decade ago
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.

Post your comments here:

Your comments will be displayed after verification.