Without encapsulation, external code can assign illegal or corrupted values directly to member variables. Encapsulation routes all modifications through validated member methods:
WITHOUT ENCAPSULATION:
External Code ──(Direct Write: balance = -50000)──► Unprotected Struct (Invalid State!)
WITH ENCAPSULATION:
External Code ──► withdraw(50000) ──► [Invariant Validation] ──► Denied / Approved