Fehlermeldung 'kann Nicht aufgelöst werden oder ist nicht ein Feld'

Recht jetzt studiere ich die chain of responsibility design pattern und bin mit Eclipse.

Und ich versuche, um diesen code zu kompilieren, aber ich habe das kompilieren der Fehler "isLast kann nicht aufgelöst werden oder ist nicht ein Feld":

public class OverFive implements Discount {
    private Discount next; //
    public boolean isLast = false;

    public void setNext(Discount next, boolean Last) {
        this.next = next;
        this.next.isLast = Last; //Here is the error.
    }

    public double DoDiscount(Budget budget) {
        if (budget.getValue() > 500) {
            return budget.getValue() * 0.10;
        }
        if (this.next.isLast == false) {
            return next.DoDiscount(budget);
        }
        else {
            return 0;
        }
    }
}

Und nun, hier ist die Schnittstelle:

public interface Discount {

    double DoDiscount(Orcamento orcamento);
        void setNext(Discount next, boolean Last);
    }
InformationsquelleAutor Raphael | 2012-06-10
Schreibe einen Kommentar