tin
tin
CC#
Created by tin on 3/4/2024 in #help
Using a default implementation on an interface
If I have an interface
interface IAttack<T> {
T GetAttack();
}
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);
}
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?
26 replies