Bonjour à tous. Je voudrais savoir si une classe dérivant d'une classe abstraite peut être définie comme une classe abstraite. J'ai construit une classe abstraite Emprunt et je dois écrire une autre classe EmpruntLivre dérivant de la classe Emprunt. Voici mes deux classes :
Classe Emprunt
Classe EmpruntLivre
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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 import java.util.Calendar; import java.util.GregorianCalendar; public abstract class Emprunt { protected Calendar dateEmprunt; public boolean estEnRetard; public Emprunt(Calendar dateEmprunt) { this.dateEmprunt = dateEmprunt; } public Calendar getdateEmprunt() { return this.dateEmprunt; } public void setdateEmprunt(Calendar dateEmprunt) { this.dateEmprunt = dateEmprunt; } public abstract boolean estEnRetard(); public void setestEnRetard (boolean estEnRetard) { this.estEnRetard = estEnRetard; } public boolean getestEnRetard() { return estEnRetard; } public int d,n; public void add(int field, int amount) { GregorianCalendar d = new GregorianCalendar(); d.add(Calendar.DAY_OF_MONTH, n); Calendar.getInstance(); } public int compareTo(Object o) { return compareTo((Object) o); } }
Merci de votre aide.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58 import java.util.Calendar; import java.util.GregorianCalendar; public abstract class EmpruntLivre extends Emprunt { protected Livre leLivre; private Livre l; private Calendar dateEmprunt; public Livre getleLivre() { return this.leLivre; } public void setleLivre(Livre leLivre) { this.leLivre = leLivre; } public EmpruntLivre(Calendar dateEmprunt, Livre l) { this.dateEmprunt = dateEmprunt; this.l = l; } public Calendar getdateEmprunt() { return this.dateEmprunt; } public void setdateEmprunt(Calendar dateEmprunt) { this.dateEmprunt = dateEmprunt; } public Livre getl() { return this.l = l; } public void setl(Livre l) { this.l = l; } public abstract boolean estEnRetard(); public void setestEnRetard (boolean estEnRetard) { this.estEnRetard = estEnRetard; } public boolean getestEnRetard() { return this.estEnRetard; } public int d,n; public void add(int field, int amount) { GregorianCalendar d = new GregorianCalendar(); d.add(Calendar.DAY_OF_MONTH, n); Calendar.getInstance(); } public int compareTo(Object o) { return compareTo((Object) o); } }
Partager