Encapsulation
Page content
class Computer:
def __init__(self):
self.__maxprice = 900
def sell(self):
print(f"Selling price: {self.__maxprice}")
def setMaxPrice(self, price):
self.__maxprice = price
c = Computer()
c.sell() # 900
c.__maxprice = 1000
c.sell() # 1000
c.setMaxPrice(1000)
c.sell() # 1000