Answer the question
In order to leave comments, you need to log in
What is the point of using new in methods?
abstract class A
{
public void hello()
{
Console.WriteLine("hello A" );
Console.ReadLine();
}
}
class B : A
{
public new void hello()
{
Console.WriteLine("hello B");
Console.ReadLine();
}
}
class Program
{
static void Main(string[] args)
{
var b = new B();
b.hello();
}
}
public new void hello()
public void hello()
Answer the question
In order to leave comments, you need to log in
what is the difference between using public new void hello() and public void hello()
if the result is the same for both, I understand that it is correct to use with new, but I'm wondering why we do this?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question