Computer Science - Object-Oriented Programming - Encapsulation - Public, Protected, Private

5 steps. Step 1 'The Problem': class BankAccount: def __init__(self): self.balance = 1000. ANYONE can do: account.balance = 999999. No validation! No protection! Step 2 'Python's Convention': self.public_attr - anyone can access. self._protected_attr - 'please don't touch' (convention only). self.__

Edodovivmagarwal
Computer Science - Object-Oriented Programming - Encapsulation - Public, Protected, Private
Log in

Preparing your experience...

Loading scripts and resources

Comments (0)

0/5000

Comments are reviewed before appearing publicly.

About this Experience

Computer Science - Object-Oriented Programming - Encapsulation - Public, Protected, Private

vivmagarwal
vivmagarwalJan 29, 2026

Description

5 steps. Step 1 'The Problem': class BankAccount: def __init__(self): self.balance = 1000. ANYONE can do: account.balance = 999999. No validation! No protection! Step 2 'Python's Convention': self.public_attr - anyone can access. self._protected_attr - 'please don't touch' (convention only). self.__

Details

Computer ScienceObject-Oriented ProgrammingClass 10, Class 10, Grade 10

Engagement

19

Likes

0

Remixes

0

Comments