Python100天打卡-Day09-面向對象進階

面向對象進階 @property裝飾器 若是想訪問屬性能夠經過屬性的getter(訪問器)和setter(修改器)方法進行對應的操做。若是要作到這點,就能夠考慮使用@property包裝器來包裝getter和setter方法,使得對屬性的訪問既安全又方便web class Person(object): def __init__(self, name, age): sel
相關文章
相關標籤/搜索