Untitled
unknown
plain_text
7 months ago
431 B
6
Indexable
Never
class Car: def __init__(self, mark, engine): self._mark = mark self.__engine = engine def show(self): print(self._mark, "public") def _my_protected_show(self): print(self._mark, "protected") def __my_private_show(self): print(self._mark, "private") car = Car("Gold mk1", "1.1") car.show() car._my_protected_show() # car.__my_private_show() # print(car.__engine)
Leave a Comment