fork download
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. #
  4. # untitled.py
  5. #
  6. # 遊園地
  7. #
  8. # This program is free software; you can redistribute it and/or modify
  9. # it under the terms of the GNU General Public License as published by
  10. # the Free Software Foundation; either version 2 of the License, or
  11. # (at your option) any later version.
  12. #
  13. # This program is distributed in the hope that it will be useful,
  14. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. # GNU General Public License for more details.
  17. #
  18. # You should have received a copy of the GNU General Public License
  19. # along with this program; if not, write to the Free Software
  20. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
  21. # MA 02110-1301, USA.
  22. #
  23. #
  24.  
  25.  
  26.  
  27. class Hello():
  28. def __init__(self):
  29. print(Hello.sain(), self.bain())
  30.  
  31. @classmethod
  32. def sain(self):
  33. return "Hello world"
  34.  
  35. def bain(self):
  36. return "NO Thank"
  37.  
  38. Hello()
  39.  
  40.  
  41.  
  42. class Hello2(Hello):
  43. def __init__(self):
  44. print(Hello.sain(),Hello2.sain01(), self.bain01())
  45.  
  46. @classmethod
  47. def sain01(self):
  48. return "aaa"
  49.  
  50. def bain01(self):
  51. return "bbb"
  52.  
  53. Hello2()
Success #stdin #stdout 0.04s 9260KB
stdin
Standard input is empty
stdout
Hello world NO Thank
Hello world aaa bbb