Skip to content

Instantly share code, notes, and snippets.

@luissilvazup
Created June 17, 2020 21:21
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/cdf27ab098a10209623e5a70399b91eb to your computer and use it in GitHub Desktop.
Save luissilvazup/cdf27ab098a10209623e5a70399b91eb to your computer and use it in GitHub Desktop.
ISP Problem
public class I_InterfaceSegregationProblem {
public interface Car {
void charge();
void openDoor();
}
public static class Fiesta implements Car {
@Override
public void charge() {
throw new UnsupportedOperationException("I'm not an electric car");
}
@Override
public void openDoor() {
//abrir a porta
}
}
public static class FocusElectric implements Car {
@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