Created
December 15, 2020 12:51
-
-
Save Abhayparashar31/28d1d868731a47b933d2b06b859e3e7b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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