class Rectangle:
def __init__(self, width=0, height=0):
self.width =width
self.height =height
def __setattr__(self, name, value):
if name == "square":
self.width =value
self.height = value
else:
super().__setattr__(name, value)
def getArea(self):
return self.width * self.height
報錯:
getattribute
getattribute
getattribute
getattribute
getattribute
getattribute
getattribute
getattribute
getattribute
問題:一運行該程式就會出現上面結果。跟著視頻上學的,不知道怎么出錯了。求大神指教!
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/175157.html
