Private variable ko aap agar direct access karte ho to apko niche wala error atta hai
print(vishal.__name_of_person)
AAp direct aise use nahi kar sakte ho … usko python me name mangling se nahi pateho
solution :-
Ex :- print(vishal._ClassName__name_of_person))
Traceback (most recent call last):
File "c:\Users\ukv-208\Downloads\prac\python\oops.py", line 28, in <module>
print(vishal.__name_of_person)
^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'test' object has no attribute '__name_of_person'
Thanks you for commenting your questions. I will see question and respond you.