Introduction to Programming using Python 1st Edition

Published by Pearson
ISBN 10: 0132747189
ISBN 13: 978-0-13274-718-9

Chapter 12 - Inheritance and Polymorphism - Section 12.6 - The isinstance Function - Check Point - MyProgrammingLab - Page 413: 12.15

Answer

The output of the given code will be Person Student

Work Step by Step

a. The person object can directly call the printPerson function which will then call getInfo function which will return Person, so Person will be printed. For student object the printPerson function is not overridden so the the definition mentioned in the parent class will be used but the getInfo function is overridden so the new definition will be used which will return Student, which will be printed. b. In this case the getInfo function is private in both class so it will only be accessible only in their class, since the printPerson is in the Person class it will only be able to access the getInfo of Person class only.
Update this answer!

You can help us out by revising, improving and updating this answer.

Update this answer

After you claim an answer you’ll have 24 hours to send in a draft. An editor will review the submission and either publish your submission or provide feedback.