Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
EPFL
IC 1
prog
serie-09
Commits
0c07cb97
Verified
Commit
0c07cb97
authored
Nov 19, 2021
by
Jonas Sulzer
🎓
Browse files
👌
IMPROVE: add comments explaining errors
Signed-off-by:
Jonas Sulzer
<
jonas@violoncello.ch
>
parent
02de5d24
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/Ex_05/AbstractFinal.java
View file @
0c07cb97
...
...
@@ -5,12 +5,12 @@ class AbstractFinal {
A
[]
tab
=
new
A
[
3
];
tab
[
0
]
=
new
A
();
tab
[
0
]
=
new
A
();
// abstract class can't be initialized
tab
[
1
]
=
new
B
();
tab
[
2
]
=
new
C
();
tab
[
1
].
b
=
2
;
((
C
)
tab
[
2
]).
c
=
3
;
tab
[
1
].
b
=
2
;
// tab is of type A, so b can't be accessed as it's not defined in A
((
C
)
tab
[
2
]).
c
=
3
;
// final can't be modified
}
}
...
...
@@ -35,7 +35,7 @@ abstract class D extends A {
abstract
int
calcul
(
int
b
)
{
}
}
// abstract class can't have content
abstract
int
machin
();
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment