This commit is contained in:
2023-04-13 15:38:06 -04:00
parent 90bfaa6ae7
commit 54ca1c76c4
6 changed files with 134 additions and 0 deletions
+18
View File
@@ -0,0 +1,18 @@
from Simulation import Simulation
class Vault:
def __init__(self):
self._treasure = "gold"
self._attributes = dict(self.__dict__)
def __setattr__(self, name, value):
if name != "_attributes" and name not in self._attributes:
print("attribute deleted!")
self._attributes[name] = value
super().__setattr__("_attributes", dict(self.__dict__))
@property
def treasure(self):
if self.__dict__ != self._attributes:
print("attribute deleted!")
return self._treasure