Quick actions

cmd+k|ctrl+k

Navigation

Languages

Python Enkapsulasi

Snippet info

Language

Python

Visibility

public

Author

riyanto.droider

Created

2026-07-09T16:09:02.498753Z

Updated

2026-07-11T04:04:40.819403Z

class BankAccount:
    
    def __init__(self, balance):
        self.__balance = balance
        
    def deposit(self, amount):
        self.__balance += amount
        
    def get_balance(self):
        return self.__balance
        
ba = BankAccount(1000)
ba.deposit(500)
balance = ba.get_balance()
print(balance)
INFO