一个简单的问题,也许对你们中的一个人很明显,但是我不确定为什么会发生。因此,这是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
提交
取消