Skip to content

Instantly share code, notes, and snippets.

@trikitrok
Created March 13, 2025 19:45
Show Gist options
  • Save trikitrok/9325892bd4aaf4141d75fd6317dc4eec to your computer and use it in GitHub Desktop.
Save trikitrok/9325892bd4aaf4141d75fd6317dc4eec to your computer and use it in GitHub Desktop.
public interface Customer {
double getEarnedDiscount();
void addToOrdersHistory(Order order);
}
// Null Customer's implementation
public class NotFoundCustomer implements Customer {
private final double DEFAULT_DISCOUNT = 1.0;
@Override
public double getEarnedDiscount() {
return DEFAULT_DISCOUNT;
}
// Refused bequest???
@Override
public void addToOrdersHistory(Order order) {
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment