Method Overriding
noun
say it: “METH-ud oh-ver-RY-ding” /ˈmɛθəd ˌoʊvərˈraɪdɪŋ/
A child class writing its own version of a method it inherited, so its objects use the new version instead of the parent's.
What is Method Overriding in JavaScript?
Method Overriding — A child class writing its own version of an inherited method.
class Alert {
text() {
return "Alert";
}
}
class EmailAlert extends Alert {
text() {
return "Email";
}
}
In a sentence
- “Overriding describe in Fighter let every fighter show its missile count, while plain ships kept the old description.”
Level: Journeyman · More JavaScript terms at this level
Updated