一個簡單的問題,也許對你們中的一個人很明顯,但是我不確定為什么會發生。因此,這是Ive制作的三個python文件。主要字符類:class Character(): """ This is the main parents class for creation of characters, be they player, NPC or monsters they shall all share common traits """ def __init__(self, name, health, defense): """Constructor for Character""" self.name = name self.health = health self.defense = defense玩家等級:from character import *class Player(Character): """ The player class is where heros are made They inherit common traits from the Character class """ def __init__(self, name, health, defense, str, int): Character.__init__(self, name, health, defense) self.str = str self.int = int在里面:from Letsago.player import Playerhero = Player("Billy", 200, 10, 10, 2) print hero.name結果是:BillyBilly為什么要退回兩次?
添加回答
舉報
0/150
提交
取消