Last active
June 8, 2023 20:07
Star
You must be signed in to star a gist
SOLID [I] - Interface Example with segmented behavior
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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