What will be the output of the following C# code?
interface i1
{
void f1();
}
interface i2 :i1
{
void f2();
}
public class maths :i2
{
public void f2()
{
Console.WriteLine("fun2");
}
public void f1()
{
Console.WriteLine("fun1");
}
}
class Program
{
static Void Main()
{
maths m = new maths();
m.f1();
m.f2();
}
}
interface i1
{
void f1();
}
interface i2 :i1
{
void f2();
}
public class maths :i2
{
public void f2()
{
Console.WriteLine("fun2");
}
public void f1()
{
Console.WriteLine("fun1");
}
}
class Program
{
static Void Main()
{
maths m = new maths();
m.f1();
m.f2();
}
}A. fun2
B. fun1
C. fun1
fun2
D. fun2
fun1
Answer: Option C
Related Questions on Classes and Objects in C Sharp
A. A blueprint for creating objects
B. A method in C#
C. A variable in C#
D. A data type in C#
A. A method in C#
B. A variable in C#
C. An instance of a class
D. A data type in C#
A. public
B. private
C. protected
D. internal

Join The Discussion