Question OOP-SOLID-0063
HardA subclass of a 'Bird' class must implement fly() but penguins can't fly, so it throws an exception. Which principle and fix apply?
- A.
Liskov Substitution; separate flying birds into a FlyingBird type or interface
- B.
Open/Closed; add an if statement
- C.
Sign up free to see the answer and a step-by-step explanation.