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 do u meant by "SBI" of an object?
If you want to write your own dot net language, what steps you will u take care?
What is c# most used for?
What is the use of static members with example using c#.net.
What is the difference between static class and abstract class in c#?
What is yield break in c#?
What is the main purpose of linq?
What is namespace explain with example?
What is disco?
what are windows services?
Does the variables of a private class-level inherited?
Which namespaces are necessary to create a localized application?
What are examples of desktop applications?
How objects are stored in memory?
What is the difference between firstordefault and first?