diff --git a/curriculum/challenges/english/blocks/lecture-understanding-object-oriented-programming-and-encapsulation/68c128cbd77e4ba9ed671937.md b/curriculum/challenges/english/blocks/lecture-understanding-object-oriented-programming-and-encapsulation/68c128cbd77e4ba9ed671937.md index 43f2596a5fb..f6b216d949b 100644 --- a/curriculum/challenges/english/blocks/lecture-understanding-object-oriented-programming-and-encapsulation/68c128cbd77e4ba9ed671937.md +++ b/curriculum/challenges/english/blocks/lecture-understanding-object-oriented-programming-and-encapsulation/68c128cbd77e4ba9ed671937.md @@ -50,10 +50,12 @@ Notice how we used `_radius` instead of radius inside the class. The underscore To make a setter to create the radius, for example, you have to define another method with the same name and use `@.setter` above it: +Using `self.radius` inside `__init__` ensures the setter runs during object creation, so invalid radius values are caught immediately. + ```py class Circle: def __init__(self, radius): - self._radius = radius + self.radius = radius # Calling the setter @property def radius(self): # A getter to get the radius @@ -90,7 +92,7 @@ A deleter runs custom logic when you use the del statement on a property. To cre ```py class Circle: def __init__(self, radius): - self._radius = radius + self.radius = radius # Getter @property