Created
April 20, 2010 05:09
-
-
Save elben/372062 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Clown(object): | |
def __init__(self, name): | |
self.name = name | |
def nice_hi(self): | |
return "Helloooo " + self.__format_name() | |
def __format_name(self): # mangled to _Clown__format_name() | |
return self.name + " (the clown)" | |
class ScaryClown(Clown): | |
def __init__(self, name): | |
Clown.__init__(self, name) | |
def __format_name(self): # mangled to _ScaryClown__format_name() | |
return self.name + " (the scary clown)" | |
c = ScaryClown("Billy") | |
print c.nice_hi() # Helloooo Billy (the clown) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment