Aside from inheritance, classes can be composed of other classes. Take our Weapon struct, for example. Paladin can easily contain a Weapon variable inside itself and have access to all its properties and methods. Let's do that by updating Paladin to take in a starting weapon and assign its value in the constructor:
public class Paladin: Character
{
public Weapon weapon;
public Paladin(string name, Weapon weapon): base(name)
{
this.weapon = weapon;
}
}
Since weapon is unique to Paladin and not Character, we need to set its initial value in the constructor. We also need to update the knight instance to include a Weapon variable. So, let's use huntingBow:
Paladin knight = new Paladin("Sir Arthur", huntingBow);
If you run the game now, you won't see anything different because we're using the PrintStatsInfo method from the Character class, which doesn't know about the Paladin class weapon property. To tackle...