Last active
July 9, 2023 17:24
-
-
Save hawkkiller/69b8fa9468d4d09ce0f79c2538c5f12d to your computer and use it in GitHub Desktop.
LSP signature requirement violation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Bird { | |
| void fly() { | |
| print('The bird is flying.'); | |
| } | |
| } | |
| class Ostrich extends Bird { | |
| @override | |
| void fly() { | |
| throw UnsupportedError('Ostriches cannot fly.'); | |
| } | |
| } | |
| void fly(Bird bird) { | |
| /// we expect there that we receive an object able to fly | |
| birf.fly(); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment