Staff(name, base) computes monthly_pay() as base. SalesRep(Staff) adds a commission and overrides monthly_pay() to base + commission; Contractor(Staff) overrides to base * 0.9 (retention withheld). Write payroll(staff_list) summing everyone's pay polymorphically.payroll([Staff('a', 100), SalesRep('b', 100, 50), Contractor('c', 100)])340.0
100 + 150 + 90.
Each override is one line of arithmetic.
sum over monthly_pay() calls.