3
Reply

Method Overriding

Ask a question
Hi All,
Why we need method overriding? instead of we can create new method
 
EX:
class Employee
{
public string GetName()
{
 
public virtual string SayHello()
{
 return "hello good morning"; 
 
Class Student:Employee
{
 public override string SayHello()
{
return "Hello good Night"; 
}
 
 
Here my question is instead of overriding SayHello() we can create New method SayHello 
 
Class Student:Employee
{
public string SayHello()
{
return "Hello good Night";
}
}
 
please explain.
 
 
Thanks,
Manohar G 
 

Answers (3)