Substitutability can lead to unforeseen interactions between objects.
Substitutability allows objects of a superclass type to be replaced with objects of a subclass type. While this provides flexibility, it can introduce complexity because the behavior of the application can change based on the actual subclass being used. This can lead to unforeseen interactions if not managed carefully. For example, if a 'DiscountedOrder' subclass overrides the 'calculateTotal' method of its superclass 'Order', an application expecting standard orders may behave unexpectedly when handling discounted orders due to different total calculations.
Additional Notes
How can substitutability through polymorphism introduce complexity?