Encapsulation:

  • It involves bundling the data (attributes) and methods that operate on the data into a single unit (class).
  • Example: A class BankAccount encapsulates data like balance and methods like deposit() and withdraw().

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *