Skip to content

Instantly share code, notes, and snippets.

@IndhumathyChelliah
Created July 14, 2020 04:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save IndhumathyChelliah/a14a0fc29897a4806f1d473bb013b68e to your computer and use it in GitHub Desktop.
Save IndhumathyChelliah/a14a0fc29897a4806f1d473bb013b68e to your computer and use it in GitHub Desktop.
class A:
def __getmethod(self):
print ("Inside Class A")
class B(A):
def __getmethod(self):
print ("Inside Class B")
b=B()
#Accessing __getmethod() in Class A using Name Mangling
b._A__getmethod()#Output:Inside Class A
#Accessing __getmethod() in Class B using Name Mangling
b._B__getmethod()#Output:Inside Class B
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment