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
What is the difference between IEnumerator and IEnumerable?
Can bool be null c#?
What does string format do?
Int map to which .net types?
What are the Features in .net framework 1.1
How long can loop recorders stay in?
What is the data provider name to connect to access database?
What is the difference between Decorator and Adapter pattern?
Can you specify an access modifier for an enumeration?
write program in c# using this instructions name avinash varma ,work experiance<2,nochildren his work experiance is higher than 5 years,more than one children one children name is diwakar,number of years of work eperiance at current company is the ratio of children and work experiance is 0.21 to 0.5
What is the signature of a method?
Explain the various types of classes used in c#?
Explain the difference between const and static read-only?
What debugging tools come with the .NET ssSDK?
what is boxing and unboxing?can we initialize unboxing directly?