se-edu / se-book

:book: Online Book: Software Engineering for Self-Directed Learners
https://se-edu.github.io/se-book/
42 stars 32 forks source link

Minor typo in textbook: Overridden methods have same return type #116

Closed E0735389 closed 9 months ago

E0735389 commented 9 months ago

https://github.com/se-edu/se-book/blob/1bda68eef0297940dbbcb57bd5e490c4ddb60d52/oop/inheritance/overriding/text.md#L9

Method overriding is when a sub-class changes the behavior inherited from the parent class by re-implementing the method. Overridden methods have the same name, same type signature, and same return type.

Actually, Java supports covariant return type. https://stackoverflow.com/a/14694885 (since Java 5, as pointed out in the answer)

damithc commented 9 months ago

Fixed. Thanks @E0735389 for the heads up.