Created
September 11, 2015 08:02
-
-
Save marc-harry/117d0c2b2b76b2af6ebb to your computer and use it in GitHub Desktop.
Base Python Samples
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
| class Greeting: | |
| def __init__(self): | |
| self.subName = 'SubName' | |
| self.attr = [] | |
| def subMethod(self): | |
| return 'SubMethod' | |
| class Hello(Greeting): | |
| name = '' | |
| def __init__(self): | |
| Greeting.__init__(self) | |
| self.name = 'shared name' | |
| self.actualName = 'each name' | |
| self.attr.append(1) | |
| def changeSub(self, random): | |
| self.subName = random | |
| def addAttr(self, att): | |
| self.attr.append(att) | |
| h = Hello() | |
| p = Hello() | |
| h.name = 'Test' | |
| p.actualName = 'new name' | |
| p.changeSub('new name') | |
| h.addAttr(2) | |
| print h.actualName + ' ' + h.name | |
| print p.actualName + ' ' + h.name | |
| print h.subName | |
| print p.subName | |
| print h.attr | |
| print p.attr | |
| print p.subMethod() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment