Lack of encapsulation can lead to unstable and insecure code.
Without encapsulation, fields are exposed and easily modified, risking inconsistent states and security issues. For instance, in an e-commerce system, if price and stock are public, any class can set invalid values, potentially causing critical errors in price calculations or inventory management.
Additional Notes
What are the consequences of not using encapsulation?