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 / lalit pradhan
namespace Test
{
class Program
{
static void Main(string[] args)
{
A a = new A();
a.Method();
B b = new B();
b.Method("From B");
Console.ReadKey();
}
}
class A
{
public void Method()
{
Console.WriteLine("From A");
}
}
class B : A
{
public void Method(string s)
{
Console.WriteLine(s);
}
}
}
Is This Answer Correct ? | 15 Yes | 1 No |
Post New Answer View All Answers
What is delegates and events?
Which programming language is best for desktop applications?
Define strong name in c#?
How many bytes is a char c#?
Why we use get set in c#?
Enlist some of the properties of a thread class?
What is difference between code access and role based security?
What is sorting in c#?
What are the return types in c#?
Is python easier than c#?
What is the difference between == and object.equals?
How Global.asax is used ?
Is c# good for games?
When To use HashTable In C#
What is a variable in c#?