Method Overriding

Last updated

What is Method Overriding?

Method overriding allows a subclass to provide a specific implementation for a method that is already defined in its superclass. When a method in a subclass has the same name, same parameters, and same return type (or a more specific return type, known as covariant return type) as a method in its superclass, the subclass's method overrides the superclass's method. This means that when the method is called on an object of the subclass, the subclass's version of the method will be executed instead of the superclass's version.

Free resources to learn Method Overriding

More in stage 11: Utility Types

Method Overriding: common questions

Can I learn Method Overriding in Hindi?

This lesson is written in English. Once you sign in, open it in the interactive course and ask the AI tutor to explain Method Overriding in Hindi or Hinglish. The tutor answers from this lesson’s own text, so it stays on the syllabus, and it runs on your own Google, OpenAI or Anthropic key.

Is this Method Overriding tutorial for beginners?

It is lesson 74 of 93 in the free TypeScript roadmap, in stage 11, Utility Types. If you are new to TypeScript, start from stage 1 and come back here in order; if you already know the earlier stages, this lesson stands on its own.

Still confused? Ask me