Challenge: Building a Composed Warrior
Завдання
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.
Рішення
Все було зрозуміло?
Дякуємо за ваш відгук!
Секція 1. Розділ 18
single
Запитати АІ
Запитати АІ
Запитайте про що завгодно або спробуйте одне із запропонованих запитань, щоб почати наш чат
Чудово!
Completion показник покращився до 3.85
Challenge: Building a Composed Warrior
Свайпніть щоб показати меню
Завдання
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.
Рішення
Все було зрозуміло?
Дякуємо за ваш відгук!
Секція 1. Розділ 18
single