initial commit
This commit is contained in:
17
Python/OOP3/task4.py
Normal file
17
Python/OOP3/task4.py
Normal file
@ -0,0 +1,17 @@
|
||||
class Person:
|
||||
def __init__(self, name: str):
|
||||
self._name = name
|
||||
|
||||
@property
|
||||
def name(self) -> str:
|
||||
return self._name
|
||||
|
||||
@name.setter
|
||||
def name(self, new_name) -> None:
|
||||
self._name = new_name
|
||||
|
||||
|
||||
p = Person("abc")
|
||||
print(p.name)
|
||||
p.name = "10"
|
||||
print(p.name)
|
Reference in New Issue
Block a user