Skip to content

Instantly share code, notes, and snippets.

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 luissilvazup/5d82e4e8da8115e2e19c51e3aac1178f to your computer and use it in GitHub Desktop.
Save luissilvazup/5d82e4e8da8115e2e19c51e3aac1178f to your computer and use it in GitHub Desktop.
ISP Solution Part 1
public class I_InterfaceSegregationSolution {
public interface Car {
void openDoor();
}
public interface ElectricCar {
void charge();
}
public static class Fiesta implements Car {
@Override
public void openDoor() {
//abrir a porta
}
}
public static class FocusElectric implements Car, ElectricCar {
@Override
public void charge() {
//recarregar
}
@Override
public void openDoor() {
//abrir porta
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment