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
How is a string immutable?
Can datetime be null c#?
Is and as keyword in c# net?
List down the reason behind the usage of c# language.
Illustrate serialization?
What is event sourcing in c#?
What is windows application in c#?
What is difference between value and reference types in C#.NET
What does mean c#?
Can I get the name of a type at runtime?
Why do we use stringbuilder in c#?
Why is it important to override gethashcode when equals method is overridden?
Write a program in C# for checking a given number is PRIME or not.
Why do canadians say zed?
What all details the assembly manifest will contain?