You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
refstruct Monster : IEntity
{
fn revive() { ... }
fn kill() { ... }
prop string EntityTypeName { get { return"Monster"; } }
}
refstruct Player : IEntity // Error: Player does not implement: fn IEntity.kill();
{
fn revive() { ... }
prop string EntityTypeName { get { return"Player"; } }
}
An interface can also be used as a type for variables and parameters which allows different types implementing the same interface to share functionality.
Type information isn't lost either which means they can be cast to their original type if needed too.