Challenge: Building a Composed Warrior
Tarefa
Swipe to start coding
Practice using composition by building a simple warrior game:
- Create a
Weaponclass with anameandattackvalue. - Create a
Warriorclass with anamethat can equip a weapon (store it as an attribute) and has a method to show its current weapon. - Equip the warrior with the weapon.
- Use composition. The warrior should have a weapon, not inherit from it.
Solução
Tudo estava claro?
Obrigado pelo seu feedback!
Seção 1. Capítulo 18
single
Pergunte à IA
Pergunte à IA
Pergunte o que quiser ou experimente uma das perguntas sugeridas para iniciar nosso bate-papo
Incrível!
Completion taxa melhorada para 3.85
Challenge: Building a Composed Warrior
Deslize para mostrar o menu
Tarefa
Swipe to start coding
Practice using composition by building a simple warrior game:
- Create a
Weaponclass with anameandattackvalue. - Create a
Warriorclass with anamethat can equip a weapon (store it as an attribute) and has a method to show its current weapon. - Equip the warrior with the weapon.
- Use composition. The warrior should have a weapon, not inherit from it.
Solução
Tudo estava claro?
Obrigado pelo seu feedback!
Seção 1. Capítulo 18
single