Skip to content

Instantly share code, notes, and snippets.

@suhailgupta03
Created December 8, 2023 16:01
Show Gist options
  • Save suhailgupta03/17097e2a3a29b866f76d9dbf79a0ace1 to your computer and use it in GitHub Desktop.
Save suhailgupta03/17097e2a3a29b866f76d9dbf79a0ace1 to your computer and use it in GitHub Desktop.
/**
* Interface Segregation Principle (ISP): Clients should not be forced to
* depend on interfaces they do not use.
*/
class Animal {
eat(){}
}
class FlyingAnimal extends Animal {
fly(){
// fly
}
}
class FlyingMammal extends FlyingAnimal {
feedWithMilk(){}
}
class SwimmingAnimal extends Animal {
swim(){
// swim
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment