CS111 Prelab 13 Answers

Task 1: Inheritance

-----
Creating instanceA
A()
-----
Invoking instanceA.m4(10)
A.m4(10)
A.m1()
A.m2(10)
instanceA.m4(10)=32
-----
Creating instanceB1
A()
B()
-----
Creating instanceB2
A()
B(8)
-----
Invoking instanceB2.m4(10)
A.m4(10)
B.m1(10)
A.m3(10)
A.m2(10)
instanceB2.m4(10)=25
-----
Invoking instanceB2.m5(10)
B.m5(10)
B.m3(10)
A.m3(10)
instanceB2.m5(10)=13
-----
Creating instanceC1
A()
B(4)
C(4,5)
C()
-----
Creating instanceC2
A()
B()
C(5)
-----
Creating instanceC3
A()
B(8)
C(8,4)
-----
Invoking instanceC3.m4(10)
A.m4(10)
B.m1(10)
A.m3(10)
C.m2(10)
instanceC3.m4(10)=35
-----
Creating instanceD
A()
B(8)
D(8)
-----
Invoking instanceD.m4(10)
A.m4(10)
B.m1(10)
A.m3(10)
D.m2(10)
instanceD.m4(10)=23
-----
Invoking instanceD.m5(10)
B.m5(10)
D.m3(10)
A.m3(10)
instanceD.m5(10)=19
-----
Invoking instanceD.m6(10)
D.m6(10)
D.m3(10)
B.m3(10)
instanceD.m6(10)=22
-----
Creating instanceE
A()
B(8)
D(8)
E()
-----
Invoking instanceE.m4(10)
A.m4(10)
B.m1(10)
A.m3(10)
D.m2(10)
instanceE.m4(10)=23
-----
Invoking instanceE.m5(10)
B.m5(10)
D.m3(10)
A.m3(10)
instanceE.m5(10)=19
-----
Invoking instanceE.m6(10)
D.m6(10)
D.m3(10)
B.m3(10)
instanceE.m6(10)=22