adplus-dvertising
frame-decoration

Question

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)
{ ... }

Answer: (a).static void fun(object i)
{ ... }

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

Q. 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?