1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
|
/* Kontofuehrung3.java */
class Konto3
{
protected int nummer; // Die Kontonummer
protected float stand = 0;
public void print()
{
System.out.println("Kontonummer: " + nummer);
System.out.println("Kontostand: " + stand);
}
// + weitere sinnvolle Elemente und Methoden
}
class Girokonto3 extends Konto3
{
private int nummer; // Die Geheimnummer
public Girokonto3 (int kontoNr, int geheimNr)
{
// Nur zur Anschauung:
super.nummer = kontoNr;
nummer = geheimNr;
}
public void print()
{
super.print();
System.out.println("Geheimnummer: " + nummer);
}
// + weitere sinnvolle Elemente und Methoden
}
public class Kontofuehrung3
{
public static void main (String[] args)
{
Girokonto3 meinKonto = new Girokonto3(1234567, 4711);
meinKonto.print();
}
|