Hallo,
ich weiß gerade nicht wie ich dieses super richtig anwende. Angenomme ich hab eine Oberklasse:
Jetzt will ich beispielsweise eine Unterklasse erzeugen :
Wie funktioniert das jetzt genau? Ich will ja nur pA und nicht auch noch pB, pC und pD.
Danke für jede Hilfe
ich weiß gerade nicht wie ich dieses super richtig anwende. Angenomme ich hab eine Oberklasse:
Java:
class Viereck {
private Point pA;
private Point pB;
private Point pC;
private Point pD;
public Viereck(Point pA, Point pB, Point pC, Point pD) {
this.pA = pA;
this.pB = pB;
this.pC = pC;
this.pD = pD;
}
Jetzt will ich beispielsweise eine Unterklasse erzeugen :
Java:
class Parallelogram extends Viereck{
protected double a;
protected double h;
protected double alpha;
public Parallelogram(Point pA, double a, double h, double alpha) {
super(); //?????
this.a = a;
this.h = h;
this.alpha = alpha;
}
Wie funktioniert das jetzt genau? Ich will ja nur pA und nicht auch noch pB, pC und pD.
Danke für jede Hilfe