Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@tuannguyenssu
Created July 7, 2019 08:48
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/1b6aea9ebd9d66aefdbba8184c2f1178 to your computer and use it in GitHub Desktop.
Save tuannguyenssu/1b6aea9ebd9d66aefdbba8184c2f1178 to your computer and use it in GitHub Desktop.
public interface IAnimal
{
void Eat();
void Drink();
void Sleep();
}
public class Dog : IAnimal
{
public void Eat () {}
public void Drink () {}
public void Sleep () {}
}
public class Cat : IAnimal
{
public void Eat () {}
public void Drink () {}
public void Sleep () {}
}
public interface IAnimal
{
void Eat();
...
void Swim();
void Fly();
}
public class Fish : IAnimal
{
public void Eat () {}
...
public void Swim() {}
public void Fly() { throw new Exception("Cá éo biết bay"); }
}
public class Bird : IAnimal
{
public void Eat () {}
...
public void Swim() { throw new Exception("Chim éo biết bơi"); }
public void Fly()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment