Encapsulation - Jupyter Notebook
Encapsulation - Jupyter Notebook
Out[2]: 'XYZ'
Out[3]: 'XYZ'
--------------------------------------------------------------------------
-
AttributeError Traceback (most recent call las
t)
Cell In[5], line 2
1 # Accessing private member through class's object
----> 2 per.__pswd
--------------------------------------------------------------------------
-
AttributeError Traceback (most recent call las
t)
Cell In[6], line 2
1 # Accessing private member through class's name
----> 2 Person.__pswd
In [9]: 1 cred.username
Out[9]: 'Hello'
In [10]: 1 cred.password
Out[10]: 'hello@123'
In [14]: 1 cred1.username
Out[14]: 'Hello'
In [15]: 1 cred1.__password
--------------------------------------------------------------------------
-
AttributeError Traceback (most recent call las
t)
Cell In[15], line 1
----> 1 cred1.__password
In [16]: 1 cred1.show()
Username: Hello
In [ ]: 1