C#C
C#2y ago
tin

Using a default implementation on an interface

If I have an interface
interface IAttack<T> {
  T GetAttack();
}

And I now want to have a specialized interface
interface IUpgradableAttack<T> : IAttack<T>{
  int level {get; set;}
  T GetAttack(int level);
}

Can I somehow use the default implementation GetAttack(){GetAttack(level)} to implement IAttack for thingss that are implementing IUpgradableAttack?
Was this page helpful?