can you overload a method of class A in Class B if it is
derived class of A?If it is yes tell me how is it possible?

Answer Posted / bhagyashri

C# Support Inheritance & in C# multiple inheritance is
achieved by using interface.multiple interface means one
class can derived by two class..and class can be derived
only one class but more than one interface.so for multiple
inheritance we use interface
for eg:
interface i1
{
public void Method1();

}
interface i2
{
public void Method2();

}
class A:i1,i2
{
public void Method1()
{
Console.WriteLine("Hi");
}
public void Method2()
{
Console.WriteLine("Hello");
}
}
class main()
{
public static void Main()
{
A a=new A();
a.Method1();
a.Method2();
Console.ReadLine();
}
}

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the use of jit ? Jit (just - in - time) is a compiler which converts msil code to

718


Why do we need constructor in c#?

684


What is state c#?

616


how background thread access to ui control?

782


What .exe means?

692


What is difference between throw and throws in c#?

627


What is string empty?

666


List the difference between the virtual method and the abstract method?

671


What is interface used in c#?

756


List down the access modifiers available in c#?

649


Why do we use public static void main in c#?

663


What is the difference between list and arraylist c#?

704


Explain the feature of c# language?

673


How does substring work in c#?

682


What Is An Interface Class?

771