Created
June 17, 2020 21:21
-
-
Save luissilvazup/cdf27ab098a10209623e5a70399b91eb to your computer and use it in GitHub Desktop.
ISP Problem
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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