セクション 1. 章 18
single
Challenge: Building a Composed Warrior
メニューを表示するにはスワイプしてください
タスク
スワイプしてコーディングを開始
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.
解答
すべて明確でしたか?
フィードバックありがとうございます!
セクション 1. 章 18
single
AIに質問する
AIに質問する
何でも質問するか、提案された質問の1つを試してチャットを始めてください