File tree Expand file tree Collapse file tree 5 files changed +5
-0
lines changed
Expand file tree Collapse file tree 5 files changed +5
-0
lines changed Original file line number Diff line number Diff line change 33// We make no guarantees that this code is fit for any purpose.
44// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
55// Trying to override a private method
6+ // {main: polymorphism.PrivateOverride}
67package polymorphism ;
78
89public class PrivateOverride {
Original file line number Diff line number Diff line change 33// We make no guarantees that this code is fit for any purpose.
44// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
55// Order of constructor calls
6+ // {main: polymorphism.Sandwich}
67package polymorphism ;
78
89class Meal {
Original file line number Diff line number Diff line change 33// We make no guarantees that this code is fit for any purpose.
44// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
55// Inheritance & upcasting
6+ // {main: polymorphism.music.Music}
67package polymorphism .music ;
78
89public class Music {
Original file line number Diff line number Diff line change 33// We make no guarantees that this code is fit for any purpose.
44// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
55// Overloading instead of upcasting
6+ // {main: polymorphism.music.Music2}
67package polymorphism .music ;
78
89class Stringed extends Instrument {
Original file line number Diff line number Diff line change 33// We make no guarantees that this code is fit for any purpose.
44// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
55// An extensible program
6+ // {main: polymorphism.music3.Music3}
67package polymorphism .music3 ;
78import polymorphism .music .Note ;
89
You can’t perform that action at this time.
0 commit comments