Challenge: Building a Composed Warrior
Tehtävä
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.
Ratkaisu
Oliko kaikki selvää?
Kiitos palautteestasi!
Osio 1. Luku 18
single
Kysy tekoälyä
Kysy tekoälyä
Kysy mitä tahansa tai kokeile jotakin ehdotetuista kysymyksistä aloittaaksesi keskustelumme
Mahtavaa!
Completion arvosana parantunut arvoon 3.85
Challenge: Building a Composed Warrior
Pyyhkäise näyttääksesi valikon
Tehtävä
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.
Ratkaisu
Oliko kaikki selvää?
Kiitos palautteestasi!
Osio 1. Luku 18
single