mirror of
https://github.com/robindhole/fundamentals.git
synced 2025-09-13 23:32:28 +00:00
Adds python code (#7)
This commit is contained in:

committed by
GitHub

parent
8c24d0345a
commit
59d2d5acfb
27
python_code/oop/basic/OopBankAccount.py
Normal file
27
python_code/oop/basic/OopBankAccount.py
Normal file
@@ -0,0 +1,27 @@
|
||||
class OopBankAccount:
|
||||
def __init__(self, balance, number):
|
||||
self.__number = number
|
||||
self.__balance = balance
|
||||
|
||||
def getNumber(self):
|
||||
return self.__number
|
||||
|
||||
def setNumber(self, number):
|
||||
self.__number = number
|
||||
|
||||
def getBalance(self):
|
||||
return self.__balance
|
||||
|
||||
def setBalance(self, balance):
|
||||
self.__balance = balance
|
||||
|
||||
def deposit(self, amount):
|
||||
self.__balance += amount
|
||||
|
||||
def withdraw(self, amount):
|
||||
self.__balance -= amount
|
||||
|
||||
def transfer(self, destination, amount):
|
||||
self.withdraw(amount)
|
||||
destination.deposit(amount)
|
||||
|
0
python_code/oop/basic/__init__.py
Normal file
0
python_code/oop/basic/__init__.py
Normal file
Reference in New Issue
Block a user