At Wednesday 8/11/2006 16:33, John Salerno wrote:

> class Character(object):
>     def __init__(self, name, strength, dexterity, intelligence):
>         self.name = name
>         self.health = 10
>         self.strength = strength
>         self.dexterity = dexterity
>         self.intelligence = intelligence
>         self.fix_attributes()
>
> class Fighter(Character):
>     def fix_attributes(self):
>         self.health += 2
>         self.strength += 1
>
> You may need a no-op implementation of fix_attributes() in the Character
> class.
>
> Peter

But how does this take care of the initialization of the stats? I won't
be able to use Fighter to create a character without doing everything in
Character, right?

Just try and see! :)
(Python is not Java, thanks Guido!)


--
Gabriel Genellina
Softlab SRL
__________________________________________________
Correo Yahoo!
Espacio para todos tus mensajes, antivirus y antispam ¡gratis! ¡Abrí tu cuenta ya! - http://correo.yahoo.com.ar
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to