Java Reference
In-Depth Information
b.
Polygon, Triangle
c.
GraduateStudent, Student
d.
Person, Student
e.
Employee, GraduateStudent
f.
BankAccount, CheckingAccount
g.
Vehicle, Car
h.
Vehicle, Minivan
i.
Car, Minivan
j.
Truck, Vehicle
Exercise R10.5. Suppose the class
Sub
extends the class
Sandwich
.
Which of the following assignments are legal?
Sandwich x = new Sandwich();
Sub y = new Sub();
a.
x = y
;
b.
y = x
;
c.
y = new Sandwich()
;
d.
x = new Sub()
;
Exercise R10.6. Draw an inheritance diagram that shows the inheritance
relationships between the classes:
ȗ
Person
ȗ
Employee
ȗ
Student
ȗ
Instructor