Consider this code:
internal class Program
{
private static void Main(string[] args)
{
var student = new Student();
student.ShowInfo(); //output --> "I am Student"
}
}
public class Person
{
public void ShowInfo()
{
Console.WriteLine("I am person");
}
}
public class Student : Person
{
public void ShowInfo()
{
Console.WriteLine("I am Student");
}
}
in above code we don't use method hiding.
when create instance of student and call showinfo
method my output is I am Student
i don't use new
keyword.
Why does not call parent method when we don't use method hiding?