Skip to content

Latest commit

 

History

History
91 lines (81 loc) · 2.79 KB

inherited-method.md

File metadata and controls

91 lines (81 loc) · 2.79 KB

Inherited Method

An inherited method is a method:

  • that is defined in an interface that your class implements,
  • and defined in your own class

OR

  • that is defined in a class that your class extends,
  • and NOT defined in your own class

For example:

interface Value<T> {
    valueOf(): T;
}

class MediaType implements Value<string> {
    // ... other properties left out

    // `valueOf()` is inherited from `Value`
    public valueOf(): string {
        return this.value;
    }
}

class ContentType extends MediaType {
    // `ContentType` has a method called `valueOf()`
    // that is inherited from `MediaType`
}