filmov
tv
java method overriding rules (manohar accademy)
![preview_player](https://i.ytimg.com/vi/nhpqZIXtfPw/maxresdefault.jpg)
Показать описание
Welcome to manohar academy.
In java we achieve dynamic polymorphism using inheritance and method overriding. In this lesson we learn 3 important rules related to method overriding.
1) Method signature should match exactly
2) Overriding method can not have more restrictive scope.
3) Return type should be either the same or covariant type
In java we achieve dynamic polymorphism using inheritance and method overriding. In this lesson we learn 3 important rules related to method overriding.
1) Method signature should match exactly
2) Overriding method can not have more restrictive scope.
3) Return type should be either the same or covariant type