Skip to content

Instantly share code, notes, and snippets.

@ThiagoBarradas
Created March 1, 2021 02:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ThiagoBarradas/eb4da2cc2350842f17688edddc67a14d to your computer and use it in GitHub Desktop.
Save ThiagoBarradas/eb4da2cc2350842f17688edddc67a14d to your computer and use it in GitHub Desktop.
SOLID [I] - Interface Example with and without Inheritance
public interface IBomb
{
void Explode();
}
public interface IHuman
{
string Name { get; set; }
string Document { get; set; }
long Age { get; set; }
}
public interface ITerrorist : IHuman, IBomb
{
}
/// class samples
public class SomeTerrorist1 : IHuman, IBomb
{
/// ...
}
public class SomeTerrorist2 : ITerrorist
{
/// ...
}
public class SomeTerrorist3 : IHuman, IBomb, IMovable
{
/// ...
}
public class SomeTerrorist4 : ITerrorist, IMovable
{
/// ...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment