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 do you encapsulate in c#?
What does dbml stand for?
If you donot specify an access modifier for a method, what is the default access modifier?
What is option parameter in C#?
What is string concatenation?
Why do we use delegates?
Explain the use of SN.exe
What is xml c#?
Which are access modifiers available in c#?
What is a reference type c#?
Which sorting algorithm is best?
How jit (just in time) works?
What is uint64_t?
Explain how to implement delegates in c#.net
What is a boolean c#?