Method Overriding
A child class replacing an inherited method with its own version.
What is Method Overriding?
Method overriding is when a child class replaces a method it inherited with its own version. Every Animal can Speak(), but a Dog overrides it to say "Woof".
public class Animal
{
public virtual string Speak() => "...";
}
public class Dog : Animal
{
public override string Speak() => "Woof";
}
Level: Apprentice · More OOP terms at this level
Updated