notesonly.in

One notebook for every subject — open it anywhere.

Log in

Encapsulation and abstraction

Object-Oriented Programming · Engineering

Study notes

A BankAccount hides balance as private; deposit() validates amount before updating. Users call deposit(100) without knowing internal storage. Changing from float to Decimal internally breaks nothing. Abstraction: a Car class exposes start(), drive(); the engine complexity is hidden. Users operate the interface, not the machinery.

← Back to topics for Engineering