Skip to content

Instantly share code, notes, and snippets.

@Abhayparashar31
Created December 15, 2020 12:51
Show Gist options
  • Save Abhayparashar31/28d1d868731a47b933d2b06b859e3e7b to your computer and use it in GitHub Desktop.
Save Abhayparashar31/28d1d868731a47b933d2b06b859e3e7b to your computer and use it in GitHub Desktop.
class Computer:
def __init__(self):
self.__maxprice = 800
def sell(self):
print("Selling Price: {}".format(self.__maxprice))
def setMaxPrice(self, price):
self.__maxprice = price
c = Computer()
c.sell()
# change the price
c.__maxprice = 1000
c.sell()
# using setter function
c.setMaxPrice(1000)
c.sell()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment