Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Part 1: Character Class (Superclass)

Create a an abstract class named Character, which will serve as the superclass for all types of characters in the game.

...

This class should have the following methods:

  • attack(): Prints an abstract method that will prints a message that the character is attacking (override in the derived class).

  • defend(): Prints an abstract method that will print a message that the character is defending (override in the derived class).

  • Getter and setter methods for each property.

...

Each subclass should override the attack() and defend() method to display a unique attack or defend style. For example, a Warrior might attack with a sword, while a Mage might use a spell. They should also have getter and setter methods for each new property.

...