Created
February 24, 2013 10:55
-
-
Save titouanc/5023404 to your computer and use it in GitHub Desktop.
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 ClasseA: | |
| def __init__(self, prenom): | |
| self.prenom = str(prenom) | |
| def getPrenom(self): | |
| return self.prenom | |
| def hello(self): | |
| print("Salut, je suis A "+self.getPrenom()) | |
| def helloHardstyle(self): | |
| prenom = ClasseA.getPrenom(self) | |
| print("Salut, je suis A "+prenom) | |
| def fonctionA(): | |
| print("Je suis la fonction du fichier A") |
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
| import fichierA | |
| a = fichierA.ClasseA('Alain') | |
| a.hello() | |
| a.helloHardstyle() | |
| fichierA.fonctionA() | |
| # === OU === | |
| from fichierA import ClasseA, fonctionA | |
| a = ClasseA('Alain') | |
| a.hello() | |
| a.helloHardstyle() | |
| fonctionA() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment