# coding = utf-8
class Game(object):
top_score = 0
def __init__(self, player_name):
self.player_name = player_name
@staticmethod
def show_help():
print("帮助信息:让僵尸进入大门")
@classmethod
def show_top_score(cls):
print("历史记录 %d" % cls.top_score)
def start_game(self):
print("%s 开始游戏啦..." % self.player_name)
if __name__ == "__main__":
Game.show_help()
Game.show_top_score()
game1 = Game("g1")
game1.start_game()
Python Class
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。
推荐阅读更多精彩内容
- Referencepython class and inheritance of object To make t...
- 对Python Class之间函数的调用关系详解https://www.jb51.net/article/1551...