Advertisement
MARSHAL327

Untitled

Sep 20th, 2024 (edited)
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.24 KB | None | 0 0
  1. class Person:
  2.     def __init__(self, name, age):
  3.         self._name = name  # Защищённый атрибут
  4.         self._age = age
  5.    
  6.     # Геттер для имени
  7.     @property
  8.     def name(self):
  9.         return self._name
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement