Skip to content

Instantly share code, notes, and snippets.

@ifucolo
Created January 31, 2017 16: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 ifucolo/863ec1516067218c4087f05018bd6745 to your computer and use it in GitHub Desktop.
Save ifucolo/863ec1516067218c4087f05018bd6745 to your computer and use it in GitHub Desktop.
public interface Car {
public void startEngine();
}
public Ferrari implements Car {
...
@Override
public double startEngine() {
//logic ...
}
}
=public Tesla implements Car{
...
@Override
public double startEngine() {
if (!IsCharged)
return;
//logic ...
}
}
public void letStartEngine(Car car) {
car.startEngine();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment