Skip to content

Instantly share code, notes, and snippets.

@tuannguyenssu
Created July 7, 2019 08:50
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 tuannguyenssu/30dcac6ae834eb894f63e1d223abe021 to your computer and use it in GitHub Desktop.
Save tuannguyenssu/30dcac6ae834eb894f63e1d223abe021 to your computer and use it in GitHub Desktop.
public interface IAnimal
{
void Eat();
void Drink();
void Sleep();
}
public interface IBird
{
void Fly();
}
public interface IFish
{
void Swim();
}
// Các class chỉ cần kế thừa những interface có chúc năng chúng cần
public class Dog : IAnimal
{
public void Eat() {}
public void Drink() {}
public void Sleep() {}
}
public class FlappyBird: IAnimal, IBird
{
public void Eat() {}
public void Drink() {}
public void Sleep() {}
public void Fly() {}
}
public class FormosaFish: IAnimal, IBird
{
public void Eat() {}
public void Drink() {}
public void Sleep() {}
public void Swim() {}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment