-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathaccess_modifier.py
53 lines (48 loc) · 1.16 KB
/
access_modifier.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
class Doctor:
def __init__(self,
name,
address,
specialities,
schedule,
degree):
self.name = name
self.address = address
self.specialities = specialities
self.schedule = schedule
self.__degree = degree
def __diagnose_patient(self):
print(F'diagnosed patient bob by doctor {self.name}')
if __name__ == '__main__':
doctor = Doctor('Dr. Bob', 'KTM', 'OPD', 'SUN: 7-8', 'MBBS')
# can get method name as
print(dir(Doctor))
# Output of print
# ['_Doctor__diagnose_patient',
# '__class__',
# '__delattr__',
# '__dict__',
# '__dir__',
# '__doc__',
# '__eq__',
# '__format__',
# '__ge__',
# '__getattribute__',
# '__gt__',
# '__hash__',
# '__init__',
# '__init_subclass__',
# '__le__',
# '__lt__',
# '__module__',
# '__ne__',
# '__new__',
# '__reduce__',
# '__reduce_ex__',
# '__repr__',
# '__setattr__',
# '__sizeof__',
# '__str__',
# '__subclasshook__',
# '__weakref__',
# 'login']
doctor._Doctor__diagnose_patient()