3
Answers

Method Overriding

Manohar Gova

Manohar Gova

8y
282
1
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)