I'm new to creating subclasses and do not know how I can "restrain" the functionality of the subclass although I'm using the superclasses' functionality. 

In my subclass, I want to use the `getCash()` method in my superclass, but I only want it to give me a result, if there has been more than 5 days since the `date` stored in my subclass. My code looks like this:

```
public class Super{

    private double cash;

    public Super(double cash){
        this.cash = cash;
    }

    public void deposit(double amount) {
        if (amount > 0){
            this.cash += amount;
        }
    }

    public double getCash(){
        if (this.cash > 0){
            return this.cash;
        }else {
            return 0;
        }
    }
}

public class Sub extends Super {

    private LocalDate date;

    public Sub(double cash) {
        super(cash);
    }
}

```

Is this the right way of attacking the problem? Or should I implement all the logic needed in my superclass, and just pass a variable telling it wether it's the superclass or the subclass calling the function? What is the best practice?

Thank you in advance.