Untitled
unknown
plain_text
2 years ago
431 B
16
Indexable
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)Editor is loading...
Leave a Comment