Created
February 22, 2015 18:37
-
-
Save datamafia/a42e47ee1b97229c92ec to your computer and use it in GitHub Desktop.
Minimal proto for subclass in Python (social media)
This file contains hidden or 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
#!/usr/bin/env python | |
class A(object): | |
var = 'A' | |
def __init__(self): | |
self.test() | |
def test(self): | |
print 'Class A: '+self.var | |
class B(A): | |
def __init__(self): | |
super(A, self).__init__() | |
self.test() | |
def test(self): | |
print 'Class B: '+self.var | |
a= A() # Class A: A | |
b= B() # Class B: A |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment