OOP Exercise
Автор: karim boughannam
Загружено: 2026-01-11
Просмотров: 5
Create a simple game character system using OOP in Python. Define an abstract base class called Character that has a class variable game = "Super Game", a default name value "Player", a concrete method info() that prints the game name and character name, and an abstract method attack() that must be implemented by child classes. Then create two child classes, Warrior and Archer, that inherit from Character, use super() in their constructors, and override the attack() method so that Warrior prints "Warrior attacks with sword" and Archer prints "Archer attacks with bow". Finally, create a list containing a Warrior() object and an Archer("Robin") object, loop over the list, and for each object call info() and attack() to demonstrate inheritance, abstraction, polymorphism, method overriding, default values, class variables, and object creation without using any conditional statements.
Доступные форматы для скачивания:
Скачать видео mp4
-
Информация по загрузке: