@property
Në shqip përdoret i njëjti emër.
ShpjegimiSQ
@property e kthen një metodë në një „veti“ që e lexon pa kllapa — p.sh. rrethi.siperfaqja. Me @emri.setter shton rregulla kur dikush e ndryshon vlerën.
EnglishEN
@property turns a method into an “attribute” you read without brackets — e.g. circle.area. With @name.setter you add rules when someone changes the value.
Si ta mendosh
Si ekrani i peshores: thjesht e lexon peshën, por nga brenda bëhet një llogaritje.
Lexoje në anglisht
Like a scale's display: you just read the weight, but a calculation happens inside.
Shembull kodipython
class Rreth:
def __init__(self, r): self.r = r
@property
def siperfaqja(self): return 3.14 * self.r ** 2
print(Rreth(2).siperfaqja)