Here are some violations in SOLID as examples
Violating Liskov’s substitution principle:
Inheritance is a purely “syntactic” relationship, whereas Liskov Substitution is also a “semantic” relationship.
How strengthened pre-condition breaks applications:
As you can see subclass object altered the baseclass price definition range for Pro Package. So this violates liskov’sSP and may crash app in later implementations.
How weakened post-condition breaks applications
One day if you extend/inherit from that baseclass to a “Free Package” subclass. It will alter the baseclass’ earlier definition and may break the app.
Example test usage:
I hope you get the point for Liskov’s Principle and how to avoid violating it.
I will continue adding more on solid’s other p’s in future.