Skip to content

Instantly share code, notes, and snippets.

@ThiagoBarradas
Last active June 8, 2023 20:07
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save ThiagoBarradas/5ab66fd5bcd060fe0bbb5f55dd30c62d to your computer and use it in GitHub Desktop.
SOLID [I] - Interface Example with segmented behavior
public interface ITalkative
{
void Speak(string message);
}
public interface IMovable
{
void Move(long x, long y, long z);
}
public interface ILivingBeing : IMovable
{
string Name { get; set; }
long Age { get; set; }
}
public interface IHuman : ILivingBeing, ITalkative
{
string Document { get; set; }
}
public interface IAnimal : ILivingBeing
{
string Type { get; set; }
void EmitSound();
}
/// class samples
public class HumanA : IHuman
{
/// ...
}
public class AnimalZ : IAnimal
{
/// ...
}
public class SomethingX : ITalkative, IMovable
{
/// ...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment